diff --git a/docker-run.sh b/docker-run.sh index 1e12f44bc..ceceb5ba2 100644 --- a/docker-run.sh +++ b/docker-run.sh @@ -1,3 +1,4 @@ #!/bin/sh ls -al envs +cat envs/.env.prod APP_ENV=$APP_ENV yarn build:preview && yarn start diff --git a/packages/env-loader/src/env-file.ts b/packages/env-loader/src/env-file.ts index 50e5f6689..7ff0758cf 100644 --- a/packages/env-loader/src/env-file.ts +++ b/packages/env-loader/src/env-file.ts @@ -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`)