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 #761

Closed
wants to merge 3 commits into from
Closed
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
1 change: 1 addition & 0 deletions docker-run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
ls -al envs
cat envs/.env.prod
APP_ENV=$APP_ENV yarn build:preview && yarn start
8 changes: 8 additions & 0 deletions packages/env-loader/src/env-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ 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.
if (appEnv && fs.existsSync(`envs/.env.${appEnv}`)) {
try {
fs.accessSync(`envs/.env.${appEnv}`, fs.constants.R_OK)
// eslint-disable-next-line no-console
console.log('can read')
} catch (err) {
// eslint-disable-next-line no-console
console.error(`no access: ${err}`)
}
return loadEnvVarsFromPath(`envs/.env.${appEnv}`)
} else if (fs.existsSync('envs/.env.local')) {
return loadEnvVarsFromPath(`envs/.env.local`)
Expand Down
Loading