From f6366160a476f42cb0612d10c5777a154d8665dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Fri, 2 Jun 2023 11:10:19 +0000 Subject: [PATCH] feat(core): Remove conditional defaults in V1 release (#6363) --- packages/cli/src/WebhookHelpers.ts | 11 +---------- packages/cli/src/commands/BaseCommand.ts | 5 ----- packages/cli/src/config/schema.ts | 12 +++++------- packages/cli/src/constants.ts | 2 -- packages/nodes-base/nodes/Code/Code.node.ts | 3 +-- packages/nodes-base/utils/constants.ts | 4 ---- 6 files changed, 7 insertions(+), 30 deletions(-) delete mode 100644 packages/nodes-base/utils/constants.ts diff --git a/packages/cli/src/WebhookHelpers.ts b/packages/cli/src/WebhookHelpers.ts index eac808d678..3d007cf574 100644 --- a/packages/cli/src/WebhookHelpers.ts +++ b/packages/cli/src/WebhookHelpers.ts @@ -697,20 +697,11 @@ export async function executeWebhook( /** * Returns the base URL of the webhooks - * */ export function getWebhookBaseUrl() { - let urlBaseWebhook = GenericHelpers.getBaseUrl(); - - // We renamed WEBHOOK_TUNNEL_URL to WEBHOOK_URL. This is here to maintain - // backward compatibility. Will be deprecated and removed in the future. - if (process.env.WEBHOOK_TUNNEL_URL !== undefined || process.env.WEBHOOK_URL !== undefined) { - // @ts-ignore - urlBaseWebhook = process.env.WEBHOOK_TUNNEL_URL || process.env.WEBHOOK_URL; - } + let urlBaseWebhook = process.env.WEBHOOK_URL ?? GenericHelpers.getBaseUrl(); if (!urlBaseWebhook.endsWith('/')) { urlBaseWebhook += '/'; } - return urlBaseWebhook; } diff --git a/packages/cli/src/commands/BaseCommand.ts b/packages/cli/src/commands/BaseCommand.ts index 9b190542d5..e9d387c440 100644 --- a/packages/cli/src/commands/BaseCommand.ts +++ b/packages/cli/src/commands/BaseCommand.ts @@ -65,11 +65,6 @@ export abstract class BaseCommand extends Command { this.exitWithCrash('There was an error running database migrations', error), ); - if (process.env.WEBHOOK_TUNNEL_URL) { - LoggerProxy.warn( - 'You are still using the WEBHOOK_TUNNEL_URL environment variable. It has been deprecated and will be removed in a future version of n8n. Please switch to using WEBHOOK_URL instead.', - ); - } const dbType = config.getEnv('database.type'); if (['mysqldb', 'mariadb'].includes(dbType)) { diff --git a/packages/cli/src/config/schema.ts b/packages/cli/src/config/schema.ts index c25db2b255..d7744cee47 100644 --- a/packages/cli/src/config/schema.ts +++ b/packages/cli/src/config/schema.ts @@ -4,7 +4,6 @@ import path from 'path'; import convict from 'convict'; import { UserSettings } from 'n8n-core'; import { jsonParse } from 'n8n-workflow'; -import { IS_V1_RELEASE } from '@/constants'; convict.addFormat({ name: 'nodes-list', @@ -225,13 +224,12 @@ export const schema = { }, executions: { - // By default workflows get always executed in their own process. - // If this option gets set to "main" it will run them in the - // main-process instead. + // By default workflows get always executed in the main process. + // TODO: remove this and all usage of `executions.process` when `own` mode is deleted process: { - doc: 'In what process workflows should be executed. Note: Own mode has been deprecated and will be removed in a future version as well as this setting.', + doc: 'In what process workflows should be executed.', format: ['main', 'own'] as const, - default: IS_V1_RELEASE ? 'main' : 'own', + default: 'main', env: 'EXECUTIONS_PROCESS', }, @@ -944,7 +942,7 @@ export const schema = { push: { backend: { format: ['sse', 'websocket'] as const, - default: IS_V1_RELEASE ? 'websocket' : 'sse', + default: 'websocket', env: 'N8N_PUSH_BACKEND', doc: 'Backend to use for push notifications', }, diff --git a/packages/cli/src/constants.ts b/packages/cli/src/constants.ts index ec00862f0c..e9969dffce 100644 --- a/packages/cli/src/constants.ts +++ b/packages/cli/src/constants.ts @@ -3,7 +3,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { readFileSync } from 'fs'; import { resolve, join, dirname } from 'path'; -import { major } from 'semver'; import type { n8n } from 'n8n-core'; import { RESPONSE_ERROR_MESSAGES as CORE_RESPONSE_ERROR_MESSAGES, UserSettings } from 'n8n-core'; import { jsonParse } from 'n8n-workflow'; @@ -30,7 +29,6 @@ export function getN8nPackageJson() { export const START_NODES = ['n8n-nodes-base.start', 'n8n-nodes-base.manualTrigger']; export const N8N_VERSION = getN8nPackageJson().version; -export const IS_V1_RELEASE = major(N8N_VERSION) > 0; export const NODE_PACKAGE_PREFIX = 'n8n-nodes-'; diff --git a/packages/nodes-base/nodes/Code/Code.node.ts b/packages/nodes-base/nodes/Code/Code.node.ts index 3af95ccccb..e524a30bad 100644 --- a/packages/nodes-base/nodes/Code/Code.node.ts +++ b/packages/nodes-base/nodes/Code/Code.node.ts @@ -12,7 +12,6 @@ import { JavaScriptSandbox } from './JavaScriptSandbox'; import { PythonSandbox } from './PythonSandbox'; import { getSandboxContext } from './Sandbox'; import { standardizeOutput } from './utils'; -import { IS_V1_RELEASE } from '../../utils/constants'; export class Code implements INodeType { description: INodeTypeDescription = { @@ -21,7 +20,7 @@ export class Code implements INodeType { icon: 'fa:code', group: ['transform'], version: [1, 2], - defaultVersion: IS_V1_RELEASE ? 2 : 1, + defaultVersion: 2, description: 'Run custom JavaScript code', defaults: { name: 'Code', diff --git a/packages/nodes-base/utils/constants.ts b/packages/nodes-base/utils/constants.ts deleted file mode 100644 index 97f1ad7ff4..0000000000 --- a/packages/nodes-base/utils/constants.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { major } from 'semver'; -import { version } from '../package.json'; - -export const IS_V1_RELEASE = major(version) > 0;