Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 1487fbd

Browse files
committed
Don't load .env files
1 parent dce2699 commit 1487fbd

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

server/aleph.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,6 @@ export class Aleph implements IAleph {
122122
await fixConfigAndImportMap(this.#workingDir, this.#config, this.#importMap)
123123
ms.stop('load config')
124124

125-
// load .env files
126-
for await (const { path: p, } of walk(this.#workingDir, { match: [/(^|\/|\\)\.env(\.|$)/i], maxDepth: 1 })) {
127-
const text = await Deno.readTextFile(p)
128-
text.split('\n').forEach(line => {
129-
let [key, value] = util.splitBy(line, '=')
130-
key = key.trim()
131-
if (key) {
132-
Deno.env.set(key, value.trim())
133-
}
134-
})
135-
log.info('load env from', basename(p))
136-
}
137-
138125
Deno.env.set('ALEPH_ENV', this.#mode)
139126
Deno.env.set('ALEPH_FRAMEWORK', this.#config.framework)
140127
Deno.env.set('ALEPH_WORKING_DIR', this.#workingDir)
@@ -206,6 +193,9 @@ export class Aleph implements IAleph {
206193
ms.stop(`load API middlewares (${middlewares.length}) from 'api/${basename(mwsFile)}'`)
207194
}
208195

196+
// apply custom env
197+
Object.entries(this.#config.env).forEach(([key, value]) => Deno.env.set(key, value))
198+
209199
// init framework
210200
const { init } = await import(`../framework/${this.#config.framework}/init.ts`)
211201
await init(this)

server/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ export async function loadConfig(specifier: string): Promise<Config> {
142142
}
143143
if (util.isPlainObject(env)) {
144144
config.env = toStringMap(env)
145-
Object.entries(env).forEach(([key, value]) => Deno.env.set(key, value))
146145
}
147146

148147
return config

0 commit comments

Comments
 (0)