MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / ensureApiKey

Function ensureApiKey

packages/setupWizard/src/models.ts:150–161  ·  view source on GitHub ↗
(provider: Provider, env: EnvVars)

Source from the content-addressed store, hash-verified

148}
149
150async function ensureApiKey(provider: Provider, env: EnvVars): Promise<string> {
151 const envKey = PROVIDER_ENV_KEYS[provider] ?? `${provider.toUpperCase().replace(/-/g, '_')}_API_KEY`;
152 if (!env[envKey]) {
153 const apiKey = await password({
154 message: `API key (stored locally in .env as ${envKey})`,
155 mask: true,
156 validate: (v) => !v?.trim() ? 'API key is required' : true,
157 });
158 env[envKey] = apiKey;
159 }
160 return envKey;
161}
162
163async function collectModelConfig(
164 provider: Provider,

Callers 1

collectModelConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected