refactor(core): Separate license state from license service (#15097)

This commit is contained in:
Iván Ovejero
2025-05-06 09:43:08 +02:00
committed by GitHub
parent e86edf536f
commit ca0e7ffe3b
18 changed files with 365 additions and 104 deletions

View File

@@ -1,4 +1,5 @@
import 'reflect-metadata';
import { LicenseState } from '@n8n/backend-common';
import { GlobalConfig } from '@n8n/config';
import { LICENSE_FEATURES } from '@n8n/constants';
import { Container } from '@n8n/di';
@@ -197,7 +198,7 @@ export abstract class BaseCommand extends Command {
);
}
const isLicensed = Container.get(License).isFeatureEnabled(LICENSE_FEATURES.BINARY_DATA_S3);
const isLicensed = Container.get(License).isLicensed(LICENSE_FEATURES.BINARY_DATA_S3);
if (!isLicensed) {
this.logger.error(
'No license found for S3 storage. \n Either set `N8N_DEFAULT_BINARY_DATA_MODE` to something else, or upgrade to a license that supports this feature.',
@@ -241,6 +242,8 @@ export abstract class BaseCommand extends Command {
this.license = Container.get(License);
await this.license.init();
Container.get(LicenseState).setLicenseProvider(this.license);
const { activationKey } = this.globalConfig.license;
if (activationKey) {