refactor: Delete a lot of unused and duplicate code in Server and WebhookServer (#5080)

* store n8n version string in a const and use that everywhere

* reduce code duplication between Server and WebhookServer

* unify redis checks

* fix linting
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-01-04 11:38:48 +01:00
committed by GitHub
parent b67f803cbe
commit 8b19fdd5f0
25 changed files with 882 additions and 1324 deletions

View File

@@ -3,7 +3,7 @@ import { ILogger } from 'n8n-workflow';
import { getLogger } from './Logger';
import config from '@/config';
import * as Db from '@/Db';
import { LICENSE_FEATURES, SETTINGS_LICENSE_CERT_KEY } from './constants';
import { LICENSE_FEATURES, N8N_VERSION, SETTINGS_LICENSE_CERT_KEY } from './constants';
async function loadCertStr(): Promise<TLicenseContainerStr> {
const databaseSettings = await Db.collections.Settings.findOne({
@@ -35,7 +35,7 @@ export class License {
this.logger = getLogger();
}
async init(instanceId: string, version: string) {
async init(instanceId: string) {
if (this.manager) {
return;
}
@@ -48,7 +48,7 @@ export class License {
this.manager = new LicenseManager({
server,
tenantId: config.getEnv('license.tenantId'),
productIdentifier: `n8n-${version}`,
productIdentifier: `n8n-${N8N_VERSION}`,
autoRenewEnabled,
autoRenewOffset,
logger: this.logger,