diff options
Diffstat (limited to 'packages/cli/src/gemini.tsx')
| -rw-r--r-- | packages/cli/src/gemini.tsx | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/packages/cli/src/gemini.tsx b/packages/cli/src/gemini.tsx index 46d9dfce..2023431f 100644 --- a/packages/cli/src/gemini.tsx +++ b/packages/cli/src/gemini.tsx @@ -17,7 +17,6 @@ import { start_sandbox } from './utils/sandbox.js'; import { LoadedSettings, loadSettings, - USER_SETTINGS_PATH, SettingScope, } from './config/settings.js'; import { themeManager } from './ui/themes/theme-manager.js'; @@ -40,6 +39,7 @@ import { } from '@google/gemini-cli-core'; import { validateAuthMethod } from './config/auth.js'; import { setMaxSizedBoxDebugging } from './ui/components/shared/MaxSizedBox.js'; +import { validateNonInteractiveAuth } from './validateNonInterActiveAuth.js'; function getNodeMemoryArgs(config: Config): string[] { const totalMemoryMB = os.totalmem() / (1024 * 1024); @@ -320,33 +320,8 @@ async function loadNonInteractiveConfig( await finalConfig.initialize(); } - return await validateNonInterActiveAuth( + return await validateNonInteractiveAuth( settings.merged.selectedAuthType, finalConfig, ); } - -async function validateNonInterActiveAuth( - selectedAuthType: AuthType | undefined, - nonInteractiveConfig: Config, -) { - // making a special case for the cli. many headless environments might not have a settings.json set - // so if GEMINI_API_KEY is set, we'll use that. However since the oauth things are interactive anyway, we'll - // still expect that exists - if (!selectedAuthType && !process.env.GEMINI_API_KEY) { - console.error( - `Please set an Auth method in your ${USER_SETTINGS_PATH} OR specify GEMINI_API_KEY env variable file before running`, - ); - process.exit(1); - } - - selectedAuthType = selectedAuthType || AuthType.USE_GEMINI; - const err = validateAuthMethod(selectedAuthType); - if (err != null) { - console.error(err); - process.exit(1); - } - - await nonInteractiveConfig.refreshAuth(selectedAuthType); - return nonInteractiveConfig; -} |
