fallback to gemini_api_key (#1255)

This commit is contained in:
matt korwel 2025-06-20 01:36:33 -07:00 committed by GitHub
parent 4e69ba3bbe
commit ef54e4ffbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 2 deletions

3
.vscode/launch.json vendored
View File

@ -13,7 +13,8 @@
"skipFiles": ["<node_internals>/**"], "skipFiles": ["<node_internals>/**"],
"cwd": "${workspaceFolder}", "cwd": "${workspaceFolder}",
"env": { "env": {
"GEMINI_SANDBOX": "false" "GEMINI_SANDBOX": "false",
"GEMINI_API_KEY": "testkey"
} }
}, },
{ {

View File

@ -11,7 +11,11 @@ import { loadCliConfig } from './config/config.js';
import { readStdin } from './utils/readStdin.js'; import { readStdin } from './utils/readStdin.js';
import { basename } from 'node:path'; import { basename } from 'node:path';
import { start_sandbox } from './utils/sandbox.js'; import { start_sandbox } from './utils/sandbox.js';
import { LoadedSettings, loadSettings } from './config/settings.js'; import {
LoadedSettings,
loadSettings,
SettingScope,
} from './config/settings.js';
import { themeManager } from './ui/themes/theme-manager.js'; import { themeManager } from './ui/themes/theme-manager.js';
import { getStartupWarnings } from './utils/startupWarnings.js'; import { getStartupWarnings } from './utils/startupWarnings.js';
import { runNonInteractive } from './nonInteractiveCli.js'; import { runNonInteractive } from './nonInteractiveCli.js';
@ -50,6 +54,16 @@ export async function main() {
const extensions = loadExtensions(workspaceRoot); const extensions = loadExtensions(workspaceRoot);
const config = await loadCliConfig(settings.merged, extensions, sessionId); const config = await loadCliConfig(settings.merged, extensions, sessionId);
// set default fallback to gemini api key
// this has to go after load cli becuase thats where the env is set
if (!settings.merged.selectedAuthType && process.env.GEMINI_API_KEY) {
settings.setValue(
SettingScope.User,
'selectedAuthType',
AuthType.USE_GEMINI,
);
}
setMaxSizedBoxDebugging(config.getDebugMode()); setMaxSizedBoxDebugging(config.getDebugMode());
// Initialize centralized FileDiscoveryService // Initialize centralized FileDiscoveryService