From 13ef3c1d20552568a928f978da89f59d1536624f Mon Sep 17 00:00:00 2001 From: Ricardo Espinoza Date: Mon, 24 Apr 2023 09:12:00 -0400 Subject: [PATCH] feat(core): Add instanceId to n8n.ready hook (no-changelog) (#6007) * add instanceId to n8n.ready hook * Set instanceId during configuration method --- packages/cli/src/AbstractServer.ts | 2 ++ packages/cli/src/Server.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/AbstractServer.ts b/packages/cli/src/AbstractServer.ts index cde2ff3fdd..55eae9376a 100644 --- a/packages/cli/src/AbstractServer.ts +++ b/packages/cli/src/AbstractServer.ts @@ -55,6 +55,8 @@ export abstract class AbstractServer { protected endpointWebhookWaiting: string; + protected instanceId = ''; + abstract configure(): Promise; constructor() { diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index c6ae91e280..e8eb44eba3 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -444,13 +444,15 @@ class Server extends AbstractServer { async configure(): Promise { configureMetrics(this.app); + this.instanceId = await UserSettings.getInstanceId(); + this.frontendSettings.isNpmAvailable = await exec('npm --version') .then(() => true) .catch(() => false); this.frontendSettings.versionCli = N8N_VERSION; - this.frontendSettings.instanceId = await UserSettings.getInstanceId(); + this.frontendSettings.instanceId = this.instanceId; await this.externalHooks.run('frontend.settings', [this.frontendSettings]);