Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tcosgrove debug prod env vars #759

Merged
merged 3 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading