mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Move instanceType to InstanceSettings (no-changelog) (#10640)
This commit is contained in:
committed by
GitHub
parent
50beefb658
commit
25c8a328a8
@@ -17,7 +17,7 @@ import {
|
||||
SETTINGS_LICENSE_CERT_KEY,
|
||||
UNLIMITED_LICENSE_QUOTA,
|
||||
} from './constants';
|
||||
import type { BooleanLicenseFeature, N8nInstanceType, NumericLicenseFeature } from './interfaces';
|
||||
import type { BooleanLicenseFeature, NumericLicenseFeature } from './interfaces';
|
||||
import type { RedisServicePubSubPublisher } from './services/redis/redis-service-pub-sub-publisher';
|
||||
import { RedisService } from './services/redis.service';
|
||||
|
||||
@@ -46,8 +46,8 @@ export class License {
|
||||
/**
|
||||
* Whether this instance should renew the license - on init and periodically.
|
||||
*/
|
||||
private renewalEnabled(instanceType: N8nInstanceType) {
|
||||
if (instanceType !== 'main') return false;
|
||||
private renewalEnabled() {
|
||||
if (this.instanceSettings.instanceType !== 'main') return false;
|
||||
|
||||
const autoRenewEnabled = config.getEnv('license.autoRenewEnabled');
|
||||
|
||||
@@ -63,7 +63,7 @@ export class License {
|
||||
return autoRenewEnabled;
|
||||
}
|
||||
|
||||
async init(instanceType: N8nInstanceType = 'main', forceRecreate = false) {
|
||||
async init(forceRecreate = false) {
|
||||
if (this.manager && !forceRecreate) {
|
||||
this.logger.warn('License manager already initialized or shutting down');
|
||||
return;
|
||||
@@ -73,6 +73,7 @@ export class License {
|
||||
return;
|
||||
}
|
||||
|
||||
const { instanceType } = this.instanceSettings;
|
||||
const isMainInstance = instanceType === 'main';
|
||||
const server = config.getEnv('license.serverUrl');
|
||||
const offlineMode = !isMainInstance;
|
||||
@@ -90,7 +91,7 @@ export class License {
|
||||
? async () => await this.licenseMetricsService.collectPassthroughData()
|
||||
: async () => ({});
|
||||
|
||||
const renewalEnabled = this.renewalEnabled(instanceType);
|
||||
const renewalEnabled = this.renewalEnabled();
|
||||
|
||||
try {
|
||||
this.manager = new LicenseManager({
|
||||
@@ -399,7 +400,7 @@ export class License {
|
||||
|
||||
async reinit() {
|
||||
this.manager?.reset();
|
||||
await this.init('main', true);
|
||||
await this.init(true);
|
||||
this.logger.debug('License reinitialized');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user