Skip to content

Commit

Permalink
Tcosgrove debug prod env vars (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
timcosgrove authored Sep 30, 2024
1 parent 4adc884 commit fba039e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 0 additions & 4 deletions packages/env-loader/src/cms-feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ export const getCmsFeatureFlags = async (
drupalBaseUrl: string,
debug: boolean = false
): Promise<EnvVars> => {
// 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)
Expand Down
9 changes: 3 additions & 6 deletions packages/env-loader/src/env-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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`)
Expand Down

0 comments on commit fba039e

Please sign in to comment.