From 10bb4eba971fe43c3d3bd5bc613ab43e70a198d1 Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Mon, 4 Nov 2024 18:00:50 -0500 Subject: [PATCH] fix: skip loading env file if context is loaded --- app/utils/config/headplane.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/utils/config/headplane.ts b/app/utils/config/headplane.ts index 984a969..fd39b32 100644 --- a/app/utils/config/headplane.ts +++ b/app/utils/config/headplane.ts @@ -35,16 +35,16 @@ export interface HeadplaneContext { let context: HeadplaneContext | undefined export async function loadContext(): Promise { + if (context) { + return context + } + const envFile = process.env.LOAD_ENV_FILE === 'true' if (envFile) { log.info('CTXT', 'Loading environment variables from .env') await import('dotenv/config') } - if (context) { - return context - } - const debug = process.env.DEBUG === 'true' if (debug) { log.info('CTXT', 'Debug mode is enabled! Logs will spam a lot.')