Skip to content

Commit d6a4a1b

Browse files
committed
fix(env): improve environment variable loading and handling
1 parent e671d24 commit d6a4a1b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.8.2
1+
1.8.3

backend/src/utils/env.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ let envLoaded = false;
55
async function loadEnvOnce() {
66
if (envLoaded) return;
77
try {
8-
await load({ export: true });
8+
const parsed = await load();
9+
for (const [key, value] of Object.entries(parsed)) {
10+
if (Deno.env.get(key) === undefined && value !== undefined) {
11+
Deno.env.set(key, value);
12+
}
13+
}
914
} catch (error) {
1015
// Ignore missing .env files, surface other errors for visibility
1116
if (!(error instanceof Deno.errors.NotFound)) {

0 commit comments

Comments
 (0)