Skip to content

Commit

Permalink
Fix .env fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Pytal committed Nov 4, 2020
1 parent 75316d4 commit 488d97c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/utils/get-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import type { DeploymentEnv, EnvVarMap } from '../types/types'
export const getEnvVarMap = async (deploymentEnv: DeploymentEnv, varNameList?: string[]) => {
let envVarMap: EnvVarMap

if (await exists(`.env.${deploymentEnv}`) ?? await exists('.env')) {
envVarMap = await GetEnvVars({ envFile: { filePath: `.env.${deploymentEnv}`, fallback: true } })
if (await exists(`.env.${deploymentEnv}`)) {
envVarMap = await GetEnvVars({ envFile: { filePath: `.env.${deploymentEnv}` } })
}
else if (await exists('.env')) {
envVarMap = await GetEnvVars({ envFile: { filePath: '.env' } })
}
else {
envVarMap = await GetEnvVars({ rc: { environments: [deploymentEnv] } })
Expand Down

0 comments on commit 488d97c

Please sign in to comment.