From 6cba652ff9ce1dfffe463188e5665e0c22f6fda0 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: Thu, 2 Feb 2023 14:01:55 +0100 Subject: [PATCH] fix(core): Load config values from files using `_FILE` env variables (no-changelog) (#5335) This broke in https://github.com/n8n-io/n8n/pull/5283/ --- packages/cli/src/config/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts index 06d3b70279..3804ab2b00 100644 --- a/packages/cli/src/config/index.ts +++ b/packages/cli/src/config/index.ts @@ -47,9 +47,11 @@ if (!inE2ETests && !inTest) { const overwrites = Object.entries(process.env).reduce>( (acc, [envName, fileName]) => { if (envName.endsWith('_FILE') && fileName) { - const key = envName.replace(/_FILE$/, ''); + const configEnvName = envName.replace(/_FILE$/, ''); // @ts-ignore - if (key in config._env) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + const key = config._env[configEnvName]?.[0] as string; + if (key) { let value: string; try { value = readFileSync(fileName, 'utf8').trim();