mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
* add sdk * add license manager * type fix * add basic func * store to db * update default * activate license * add sharing flag * fix setup * clear license * update conosle log to info * refactor * use npm dependency * update error logs * add simple test * add license tests * update tests * update pnpm package * fix error handling types * Update packages/cli/src/config/schema.ts Co-authored-by: Cornelius Suermann <cornelius@n8n.io> * make feature enum * add warning * update sdk * Update packages/cli/src/config/schema.ts Co-authored-by: Cornelius Suermann <cornelius@n8n.io> Co-authored-by: Cornelius Suermann <cornelius@n8n.io>
43 lines
990 B
TypeScript
43 lines
990 B
TypeScript
import { Command } from '@oclif/command';
|
|
|
|
import { LoggerProxy } from 'n8n-workflow';
|
|
|
|
import * as Db from '@/Db';
|
|
|
|
import { getLogger } from '@/Logger';
|
|
import { SETTINGS_LICENSE_CERT_KEY } from '@/constants';
|
|
|
|
export class ClearLicenseCommand extends Command {
|
|
static description = 'Clear license';
|
|
|
|
static examples = [`$ n8n clear:license`];
|
|
|
|
async run() {
|
|
const logger = getLogger();
|
|
LoggerProxy.init(logger);
|
|
|
|
try {
|
|
await Db.init();
|
|
|
|
console.info('Clearing license from database.');
|
|
await Db.collections.Settings.delete({
|
|
key: SETTINGS_LICENSE_CERT_KEY,
|
|
});
|
|
console.info('Done. Restart n8n to take effect.');
|
|
} catch (e: unknown) {
|
|
console.error('Error updating database. See log messages for details.');
|
|
logger.error('\nGOT ERROR');
|
|
logger.info('====================================');
|
|
if (e instanceof Error) {
|
|
logger.error(e.message);
|
|
if (e.stack) {
|
|
logger.error(e.stack);
|
|
}
|
|
}
|
|
this.exit(1);
|
|
}
|
|
|
|
this.exit();
|
|
}
|
|
}
|