Skip to content

Commit

Permalink
Tcosgrove debug prod env vars (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
timcosgrove authored Sep 30, 2024
1 parent 865b84d commit 4adc884
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docker-run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

ls -al envs
APP_ENV=$APP_ENV yarn build:preview && yarn start
4 changes: 4 additions & 0 deletions packages/env-loader/src/env-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ const loadEnvVarsFromPath = (path: string): 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 4adc884

Please sign in to comment.