fleet/website/api/controllers/admin/build-license-key.js
Eric ab504d766a
Website: Update admin license generator (#13101)
Closes: https://github.com/fleetdm/confidential/issues/3230

Changes:
- Added a new (optional) input to the admin license key generator:
`partnerName`.
- Renamed `admin/generate-license-key.js` to
`admin/build-license-key.js`, updated routes and regenerated
`cloud.setup.js`
- Updated the create license key helper to add a `partner` field to the
generated license key if `partnerName` is provided.
2023-08-04 14:48:29 -05:00

55 lines
1,004 B
JavaScript
Vendored

module.exports = {
friendlyName: 'Build license key',
description: 'Build and return a Fleet Premium license key.',
inputs: {
numberOfHosts: {
type: 'number',
required: true,
},
organization: {
type: 'string',
required: true,
},
expiresAt: {
type: 'number',
required: true,
description: 'A JS timestamp representing when this license will expire.',
},
partnerName: {
type: 'string',
description: 'The name of the partner that will be reselling the generated license.',
}
},
exits: {
success: {
outputFriendlyName: 'License key',
outputType: 'string',
},
},
fn: async function ({numberOfHosts, organization, expiresAt, partnerName}) {
let licenseKey = await sails.helpers.createLicenseKey.with({
numberOfHosts: numberOfHosts,
organization: organization,
expiresAt: expiresAt,
partnerName: partnerName,
});
return licenseKey;
}
};