From 16b7d55357afa3b5145b676ee7dc23b9fd8fdb90 Mon Sep 17 00:00:00 2001 From: Mutasem Date: Thu, 8 Jul 2021 09:42:36 +0200 Subject: [PATCH] update cli to return version information --- packages/cli/config/index.ts | 21 +++++++++++++++++++++ packages/cli/src/Interfaces.ts | 6 ++++++ packages/cli/src/Server.ts | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/packages/cli/config/index.ts b/packages/cli/config/index.ts index 0da11e786a..94f68a3d3e 100644 --- a/packages/cli/config/index.ts +++ b/packages/cli/config/index.ts @@ -618,6 +618,27 @@ const config = convict({ }, }, + versionNotifications: { + enabled: { + doc: 'Whether feature to request more version information is enabled.', + format: Boolean, + default: true, + env: 'N8N_VERSION_NOTIFICATIONS_ENABLED', + }, + endpoint: { + doc: 'Endpoint to retrieve version information from.', + format: String, + default: 'https://api-staging.n8n.io/versions/', + env: 'N8N_VERSION_NOTIFICATIONS_ENDPOINT', + }, + infoUrl: { + doc: 'Url in updates panel UI to get more informaton on updating instance', + format: String, + default: 'https://docs.n8n.io/reference/', + env: 'N8N_VERSION_NOTIFICATIONS_ENDPOINT', + } + }, + }); // Overwrite default configuration with settings which got defined in diff --git a/packages/cli/src/Interfaces.ts b/packages/cli/src/Interfaces.ts index e1c09cf55e..423c4c1c4b 100644 --- a/packages/cli/src/Interfaces.ts +++ b/packages/cli/src/Interfaces.ts @@ -312,6 +312,11 @@ export interface IN8nConfigNodes { exclude: string[]; } +export interface IVersionNotificationSettings { + enabled: boolean; + endpoint: string; + infoUrl: string; +} export interface IN8nUISettings { endpointWebhook: string; @@ -331,6 +336,7 @@ export interface IN8nUISettings { n8nMetadata?: { [key: string]: string | number | undefined; }; + versionNotifications: IVersionNotificationSettings; } export interface IPackageVersions { diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index ee2f50f2cf..7262e4d033 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -196,6 +196,11 @@ class App { 'oauth1': urlBaseWebhook + `${this.restEndpoint}/oauth1-credential/callback`, 'oauth2': urlBaseWebhook + `${this.restEndpoint}/oauth2-credential/callback`, }, + versionNotifications: { + enabled: config.get('versionNotifications.enabled'), + endpoint: config.get('versionNotifications.endpoint'), + infoUrl: config.get('versionNotifications.infoUrl'), + }, }; }