mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-20 06:02:14 +03:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user