fix(auth): do not blindly default to API key auth (#3235)

Co-authored-by: matt korwel <matt.korwel@gmail.com>
Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Pascal Birchler
2025-07-09 00:10:36 +02:00
committed by GitHub
parent 0506b40a39
commit c8cf954e6e
3 changed files with 69 additions and 24 deletions

View File

@@ -17,8 +17,8 @@ import { start_sandbox } from './utils/sandbox.js';
import {
LoadedSettings,
loadSettings,
SettingScope,
USER_SETTINGS_PATH,
SettingScope,
} from './config/settings.js';
import { themeManager } from './ui/themes/theme-manager.js';
import { getStartupWarnings } from './utils/startupWarnings.js';
@@ -111,15 +111,9 @@ export async function main() {
process.exit(0);
}
// Set a default auth type if one isn't set for a couple of known cases.
// Set a default auth type if one isn't set.
if (!settings.merged.selectedAuthType) {
if (process.env.GEMINI_API_KEY) {
settings.setValue(
SettingScope.User,
'selectedAuthType',
AuthType.USE_GEMINI,
);
} else if (process.env.CLOUD_SHELL === 'true') {
if (process.env.CLOUD_SHELL === 'true') {
settings.setValue(
SettingScope.User,
'selectedAuthType',