fix(startup): pass env through env-file lookup

Keep getPreferredEnvFilePath consistent with its env parameter by
passing that env through resolveDataDir in both bootstrap and Electron.

This avoids silently falling back to process.env when a custom env map
is supplied.
This commit is contained in:
Kfir Amar
2026-03-14 21:33:34 +02:00
parent e3a2bd75f3
commit b19e6a8e87
2 changed files with 2 additions and 2 deletions

View File

@@ -88,7 +88,7 @@ function getPreferredEnvFilePath(env = process.env) {
candidates.push(path.join(path.resolve(env.DATA_DIR.trim()), ".env"));
}
candidates.push(path.join(resolveDataDir(), ".env"));
candidates.push(path.join(resolveDataDir(null, env), ".env"));
candidates.push(path.join(process.cwd(), ".env"));
return candidates.find((filePath) => fs.existsSync(filePath)) || null;

View File

@@ -58,7 +58,7 @@ function getPreferredEnvFilePath(env = process.env) {
candidates.push(join(resolve(env.DATA_DIR.trim()), ".env"));
}
candidates.push(join(resolveDataDir(), ".env"));
candidates.push(join(resolveDataDir(null, env), ".env"));
candidates.push(join(process.cwd(), ".env"));
return candidates.find((filePath) => existsSync(filePath)) ?? null;