From 0e347b001b2f3602a7c322aa2aa7099124d0c45d Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Tue, 19 Mar 2024 16:04:26 +0000 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20override=20TRIGGER=5FSECRET=5FK?= =?UTF-8?q?EY=20and=20TRIGGER=5FAPI=5FURL=20with=20local=20env=20vars?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cli-v3/src/workers/dev/backgroundWorker.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/cli-v3/src/workers/dev/backgroundWorker.ts b/packages/cli-v3/src/workers/dev/backgroundWorker.ts index 26b4823df..391b162b8 100644 --- a/packages/cli-v3/src/workers/dev/backgroundWorker.ts +++ b/packages/cli-v3/src/workers/dev/backgroundWorker.ts @@ -302,8 +302,8 @@ export class BackgroundWorker { const child = fork(this.path, { stdio: [/*stdin*/ "ignore", /*stdout*/ "pipe", /*stderr*/ "pipe", "ipc"], env: { - ...this.#readEnvVars(), ...this.params.env, + ...this.#readEnvVars(), }, }); @@ -475,13 +475,19 @@ export class BackgroundWorker { } #readEnvVars() { - const result = {}; + const result: { [key: string]: string } = {}; dotenv.config({ processEnv: result, path: [".env", ".env.local", ".env.development.local"].map((p) => resolve(process.cwd(), p)), }); + process.env.TRIGGER_API_URL && (result.TRIGGER_API_URL = process.env.TRIGGER_API_URL); + + // remove TRIGGER_API_URL and TRIGGER_SECRET_KEY, since those should be coming from the worker + delete result.TRIGGER_API_URL; + delete result.TRIGGER_SECRET_KEY; + return result; }