2022-11-21 06:41:24 -08:00
|
|
|
import { SETTINGS_LICENSE_CERT_KEY } from '@/constants';
|
2023-02-10 05:59:20 -08:00
|
|
|
import { BaseCommand } from '../BaseCommand';
|
2023-11-10 06:04:26 -08:00
|
|
|
import { SettingsRepository } from '@db/repositories/settings.repository';
|
|
|
|
import Container from 'typedi';
|
2022-11-21 06:41:24 -08:00
|
|
|
|
2023-02-10 05:59:20 -08:00
|
|
|
export class ClearLicenseCommand extends BaseCommand {
|
2022-11-21 06:41:24 -08:00
|
|
|
static description = 'Clear license';
|
|
|
|
|
2022-12-29 03:20:43 -08:00
|
|
|
static examples = ['$ n8n clear:license'];
|
2022-11-21 06:41:24 -08:00
|
|
|
|
|
|
|
async run() {
|
2023-02-10 05:59:20 -08:00
|
|
|
this.logger.info('Clearing license from database.');
|
2023-11-10 06:04:26 -08:00
|
|
|
await Container.get(SettingsRepository).delete({
|
2023-02-10 05:59:20 -08:00
|
|
|
key: SETTINGS_LICENSE_CERT_KEY,
|
|
|
|
});
|
|
|
|
this.logger.info('Done. Restart n8n to take effect.');
|
|
|
|
}
|
2022-11-21 06:41:24 -08:00
|
|
|
|
2023-02-10 05:59:20 -08:00
|
|
|
async catch(error: Error) {
|
|
|
|
this.logger.error('Error updating database. See log messages for details.');
|
|
|
|
this.logger.error('\nGOT ERROR');
|
|
|
|
this.logger.info('====================================');
|
|
|
|
this.logger.error(error.message);
|
|
|
|
this.logger.error(error.stack!);
|
2022-11-21 06:41:24 -08:00
|
|
|
}
|
|
|
|
}
|