From fba039ee2a10e35480702ff04209d24dec708275 Mon Sep 17 00:00:00 2001 From: Tim Cosgrove Date: Mon, 30 Sep 2024 12:18:42 -0700 Subject: [PATCH] Tcosgrove debug prod env vars (#759) --- packages/env-loader/src/cms-feature-flags.ts | 4 ---- packages/env-loader/src/env-file.ts | 9 +++------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/env-loader/src/cms-feature-flags.ts b/packages/env-loader/src/cms-feature-flags.ts index 01405ae75..b504133a7 100644 --- a/packages/env-loader/src/cms-feature-flags.ts +++ b/packages/env-loader/src/cms-feature-flags.ts @@ -8,10 +8,6 @@ export const getCmsFeatureFlags = async ( drupalBaseUrl: string, debug: boolean = false ): Promise => { - // eslint-disable-next-line no-console - console.log('about to dump GTM value for debugging.') - // eslint-disable-next-line no-console - console.log(process.env.NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID) const fetcher = getFetcher(drupalBaseUrl, debug) const featureFlagUrl = `${removeTrailingSlash(drupalBaseUrl)}/flags_list` const response = await fetcher(featureFlagUrl) diff --git a/packages/env-loader/src/env-file.ts b/packages/env-loader/src/env-file.ts index d1e27b907..0b2e1492c 100644 --- a/packages/env-loader/src/env-file.ts +++ b/packages/env-loader/src/env-file.ts @@ -4,7 +4,7 @@ import dotenvExpand from 'dotenv-expand' import { EnvVars } from '.' const loadEnvVarsFromPath = (path: string): EnvVars => { - const envVars = {} + let envVars = {} dotenvExpand.expand( dotenv.config({ path, @@ -15,18 +15,15 @@ const loadEnvVarsFromPath = (path: string): EnvVars => { // eslint-disable-next-line no-console console.log(`Using environment variables from: ${path}`) - + // eslint-disable-next-line no-console + console.log(envVars) return envVars } export const getEnvFileVars = (appEnv?: string): EnvVars => { // Load env vars from `.env.${process.env.APP_ENV}` if it exists, // otherwise load env vars from `.env.local` if it exists. - // eslint-disable-next-line no-console - console.log(`appEnv is ${appEnv}`) if (appEnv && fs.existsSync(`envs/.env.${appEnv}`)) { - // eslint-disable-next-line no-console - console.log(`we are trying to read envs/.env.${appEnv}`) return loadEnvVarsFromPath(`envs/.env.${appEnv}`) } else if (fs.existsSync('envs/.env.local')) { return loadEnvVarsFromPath(`envs/.env.local`)