Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

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

Kfir Amarb19e6a8e8757
diff --git a/electron/main.js b/electron/main.js
index 95838d9e9b..1d3c231728 100644
--- a/electron/main.js
+++ b/electron/main.js
@@ -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;
diff --git a/scripts/bootstrap-env.mjs b/scripts/bootstrap-env.mjs
index a3c1c6fbaa..de8bfa790d 100644
--- a/scripts/bootstrap-env.mjs
+++ b/scripts/bootstrap-env.mjs
@@ -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;