mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 00:23:29 +00:00
Onboard: store OpenAI auth in profiles instead of .env
This commit is contained in:
committed by
Peter Steinberger
parent
09c7cb5d34
commit
68b9d89ee7
@@ -42,6 +42,7 @@ import {
|
||||
setMistralApiKey,
|
||||
setMinimaxApiKey,
|
||||
setMoonshotApiKey,
|
||||
setOpenaiApiKey,
|
||||
setOpencodeZenApiKey,
|
||||
setOpenrouterApiKey,
|
||||
setSyntheticApiKey,
|
||||
@@ -408,15 +409,16 @@ export async function applyNonInteractiveAuthChoice(params: {
|
||||
flagName: "--openai-api-key",
|
||||
envVar: "OPENAI_API_KEY",
|
||||
runtime,
|
||||
allowProfile: false,
|
||||
});
|
||||
if (!resolved) {
|
||||
return null;
|
||||
}
|
||||
const key = resolved.key;
|
||||
const result = upsertSharedEnvVar({ key: "OPENAI_API_KEY", value: key });
|
||||
process.env.OPENAI_API_KEY = key;
|
||||
runtime.log(`Saved OPENAI_API_KEY to ${shortenHomePath(result.path)}`);
|
||||
await setOpenaiApiKey(resolved.key);
|
||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||
profileId: "openai:default",
|
||||
provider: "openai",
|
||||
mode: "api_key",
|
||||
});
|
||||
return applyOpenAIConfig(nextConfig);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user