feat(utils): use dotenv-expand to allow variables within env (#8720)

This commit is contained in:
Shahed Nasser
2024-08-22 13:51:36 +03:00
committed by GitHub
parent 0acd94aac3
commit bc74e381ad
3 changed files with 14 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
import dotenv from "dotenv"
import { expand } from "dotenv-expand"
import { join } from "path"
const KNOWN_ENVIRONMENTS = ["staging", "production", "test"]
@@ -19,6 +20,6 @@ export function loadEnv(environment: string, envDir: string) {
? `.env.${environment}`
: ".env"
try {
dotenv.config({ path: join(envDir, fileToLoad) })
expand(dotenv.config({ path: join(envDir, fileToLoad) }))
} catch {}
}