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

29 lines
650 B
TypeScript

/*!
* Copyright 2019-2020 Lime Technology Inc. All rights reserved.
* Written by: Alexis Tyler
*/
import { CoreResult, CoreContext } from '../../types';
import { ensurePermission, getMachineId as getMachineIdFromFile } from '../../utils';
/**
* Get the machine ID.
*/
export const getMachineId = async function (context: CoreContext): Promise<CoreResult> {
const { user } = context;
// Check permissions
ensurePermission(user, {
resource: 'machine-id',
action: 'read',
possession: 'any'
});
const machineId = getMachineIdFromFile();
return {
text: `Machine ID: ${JSON.stringify(machineId, null, 2)}`,
json: machineId
};
};