mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): Use an IoC container to manage singleton classes [Part-2] (no-changelog) (#5690)
* use typedi for UserManagementMailer * use typedi for SamlService * fix typos * use typedi for Queue * use typedi for License * convert some more code to use typedi
This commit is contained in:
committed by
GitHub
parent
c07f838ce6
commit
9bd7529193
@@ -5,6 +5,7 @@ import { getLogger } from './Logger';
|
||||
import config from '@/config';
|
||||
import * as Db from '@/Db';
|
||||
import { LICENSE_FEATURES, N8N_VERSION, SETTINGS_LICENSE_CERT_KEY } from './constants';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
async function loadCertStr(): Promise<TLicenseContainerStr> {
|
||||
const databaseSettings = await Db.collections.Settings.findOne({
|
||||
@@ -27,6 +28,7 @@ async function saveCertStr(value: TLicenseContainerStr): Promise<void> {
|
||||
);
|
||||
}
|
||||
|
||||
@Service()
|
||||
export class License {
|
||||
private logger: ILogger;
|
||||
|
||||
@@ -160,13 +162,3 @@ export class License {
|
||||
return (this.getFeatureValue('planName') ?? 'Community') as string;
|
||||
}
|
||||
}
|
||||
|
||||
let licenseInstance: License | undefined;
|
||||
|
||||
export function getLicense(): License {
|
||||
if (licenseInstance === undefined) {
|
||||
licenseInstance = new License();
|
||||
}
|
||||
|
||||
return licenseInstance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user