diff options
| author | matt korwel <[email protected]> | 2025-06-20 01:36:33 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-20 01:36:33 -0700 |
| commit | ef54e4ffbc4ff884c43fd2d214371469a66c5aca (patch) | |
| tree | 95415f0b5b2ff43edab5290a4ff5a367ea4d3cbf | |
| parent | 4e69ba3bbe2dd1b78a9ee744b892b8b199790a44 (diff) | |
fallback to gemini_api_key (#1255)
| -rw-r--r-- | .vscode/launch.json | 3 | ||||
| -rw-r--r-- | packages/cli/src/gemini.tsx | 16 |
2 files changed, 17 insertions, 2 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json index 38740d05..95c1bf69 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,7 +13,8 @@ "skipFiles": ["<node_internals>/**"], "cwd": "${workspaceFolder}", "env": { - "GEMINI_SANDBOX": "false" + "GEMINI_SANDBOX": "false", + "GEMINI_API_KEY": "testkey" } }, { diff --git a/packages/cli/src/gemini.tsx b/packages/cli/src/gemini.tsx index 4f16f0b0..9657ba8f 100644 --- a/packages/cli/src/gemini.tsx +++ b/packages/cli/src/gemini.tsx @@ -11,7 +11,11 @@ import { loadCliConfig } from './config/config.js'; import { readStdin } from './utils/readStdin.js'; import { basename } from 'node:path'; 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 { getStartupWarnings } from './utils/startupWarnings.js'; import { runNonInteractive } from './nonInteractiveCli.js'; @@ -50,6 +54,16 @@ export async function main() { const extensions = loadExtensions(workspaceRoot); 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()); // Initialize centralized FileDiscoveryService |
