mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 14:04:58 +00:00
Onboard: move volcengine/byteplus auth from .env to profiles
This commit is contained in:
committed by
Peter Steinberger
parent
2ef109f00a
commit
59e5f12bf9
@@ -1,8 +1,10 @@
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
setByteplusApiKey,
|
||||
setCloudflareAiGatewayConfig,
|
||||
setMoonshotApiKey,
|
||||
setOpenaiApiKey,
|
||||
setVolcengineApiKey,
|
||||
} from "./onboard-auth.js";
|
||||
import {
|
||||
createAuthTestLifecycle,
|
||||
@@ -18,6 +20,8 @@ describe("onboard auth credentials secret refs", () => {
|
||||
"MOONSHOT_API_KEY",
|
||||
"OPENAI_API_KEY",
|
||||
"CLOUDFLARE_AI_GATEWAY_API_KEY",
|
||||
"VOLCANO_ENGINE_API_KEY",
|
||||
"BYTEPLUS_API_KEY",
|
||||
]);
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -137,4 +141,28 @@ describe("onboard auth credentials secret refs", () => {
|
||||
});
|
||||
expect(parsed.profiles?.["openai:default"]?.key).toBeUndefined();
|
||||
});
|
||||
|
||||
it("stores env-backed volcengine and byteplus keys as keyRef", async () => {
|
||||
const env = await setupAuthTestEnv("openclaw-onboard-auth-credentials-volc-byte-");
|
||||
lifecycle.setStateDir(env.stateDir);
|
||||
process.env.VOLCANO_ENGINE_API_KEY = "volcengine-secret";
|
||||
process.env.BYTEPLUS_API_KEY = "byteplus-secret";
|
||||
|
||||
await setVolcengineApiKey("volcengine-secret");
|
||||
await setByteplusApiKey("byteplus-secret");
|
||||
|
||||
const parsed = await readAuthProfilesForAgent<{
|
||||
profiles?: Record<string, { key?: string; keyRef?: unknown }>;
|
||||
}>(env.agentDir);
|
||||
|
||||
expect(parsed.profiles?.["volcengine:default"]).toMatchObject({
|
||||
keyRef: { source: "env", id: "VOLCANO_ENGINE_API_KEY" },
|
||||
});
|
||||
expect(parsed.profiles?.["volcengine:default"]?.key).toBeUndefined();
|
||||
|
||||
expect(parsed.profiles?.["byteplus:default"]).toMatchObject({
|
||||
keyRef: { source: "env", id: "BYTEPLUS_API_KEY" },
|
||||
});
|
||||
expect(parsed.profiles?.["byteplus:default"]?.key).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user