Files
api/app/core/modules/get-vars.ts
T
Alexis Tyler 4e1b0bd72c chore: lint
2021-01-28 15:45:14 +10:30

30 lines
621 B
TypeScript

/*!
* Copyright 2019-2020 Lime Technology Inc. All rights reserved.
* Written by: Alexis Tyler
*/
import { CoreContext, CoreResult } from '../types';
import { varState } from '../states';
import { ensurePermission } from '../utils';
/**
* Get all system vars.
*/
export const getVars = async (context: CoreContext): Promise<CoreResult> => {
const { user } = context;
// Bail if the user doesn't have permission
ensurePermission(user, {
resource: 'vars',
action: 'read',
possession: 'any'
});
return {
text: `Vars: ${JSON.stringify(varState.data, null, 2)}`,
json: {
...varState.data
}
};
};