From 73ba4a5973e7188e7fd4dd8ca74b21b02ae67b9f Mon Sep 17 00:00:00 2001 From: Ricardo Espinoza <ricardo@n8n.io> 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 cde2ff3fdd029..55eae9376a520 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<void>; constructor() { diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index c6ae91e2800c2..e8eb44eba3392 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -444,13 +444,15 @@ class Server extends AbstractServer { async configure(): Promise<void> { 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]);