mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:20:43 +00:00
fix(secrets): cache guarded channel assignment helpers
This commit is contained in:
@@ -5,20 +5,21 @@ const discordSecrets = loadBundledChannelSecretContractApi("discord");
|
||||
if (!discordSecrets?.collectRuntimeConfigAssignments) {
|
||||
throw new Error("Missing Discord secret contract api");
|
||||
}
|
||||
const discordAssignments = discordSecrets.collectRuntimeConfigAssignments;
|
||||
|
||||
vi.mock("../channels/plugins/bootstrap-registry.js", () => ({
|
||||
getBootstrapChannelPlugin: (id: string) =>
|
||||
id === "discord"
|
||||
? {
|
||||
secrets: {
|
||||
collectRuntimeConfigAssignments: discordSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: discordAssignments,
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
getBootstrapChannelSecrets: (id: string) =>
|
||||
id === "discord"
|
||||
? {
|
||||
collectRuntimeConfigAssignments: discordSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: discordAssignments,
|
||||
}
|
||||
: undefined,
|
||||
}));
|
||||
|
||||
@@ -5,20 +5,21 @@ const matrixSecrets = loadBundledChannelSecretContractApi("matrix");
|
||||
if (!matrixSecrets?.collectRuntimeConfigAssignments) {
|
||||
throw new Error("Missing Matrix secret contract api");
|
||||
}
|
||||
const matrixAssignments = matrixSecrets.collectRuntimeConfigAssignments;
|
||||
|
||||
vi.mock("../channels/plugins/bootstrap-registry.js", () => ({
|
||||
getBootstrapChannelPlugin: (id: string) =>
|
||||
id === "matrix"
|
||||
? {
|
||||
secrets: {
|
||||
collectRuntimeConfigAssignments: matrixSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: matrixAssignments,
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
getBootstrapChannelSecrets: (id: string) =>
|
||||
id === "matrix"
|
||||
? {
|
||||
collectRuntimeConfigAssignments: matrixSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: matrixAssignments,
|
||||
}
|
||||
: undefined,
|
||||
}));
|
||||
|
||||
@@ -5,20 +5,21 @@ const nextcloudTalkSecrets = loadBundledChannelSecretContractApi("nextcloud-talk
|
||||
if (!nextcloudTalkSecrets?.collectRuntimeConfigAssignments) {
|
||||
throw new Error("Missing Nextcloud Talk secret contract api");
|
||||
}
|
||||
const nextcloudTalkAssignments = nextcloudTalkSecrets.collectRuntimeConfigAssignments;
|
||||
|
||||
vi.mock("../channels/plugins/bootstrap-registry.js", () => ({
|
||||
getBootstrapChannelPlugin: (id: string) =>
|
||||
id === "nextcloud-talk"
|
||||
? {
|
||||
secrets: {
|
||||
collectRuntimeConfigAssignments: nextcloudTalkSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: nextcloudTalkAssignments,
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
getBootstrapChannelSecrets: (id: string) =>
|
||||
id === "nextcloud-talk"
|
||||
? {
|
||||
collectRuntimeConfigAssignments: nextcloudTalkSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: nextcloudTalkAssignments,
|
||||
}
|
||||
: undefined,
|
||||
}));
|
||||
|
||||
@@ -5,20 +5,21 @@ const telegramSecrets = loadBundledChannelSecretContractApi("telegram");
|
||||
if (!telegramSecrets?.collectRuntimeConfigAssignments) {
|
||||
throw new Error("Missing Telegram secret contract api");
|
||||
}
|
||||
const telegramAssignments = telegramSecrets.collectRuntimeConfigAssignments;
|
||||
|
||||
vi.mock("../channels/plugins/bootstrap-registry.js", () => ({
|
||||
getBootstrapChannelPlugin: (id: string) =>
|
||||
id === "telegram"
|
||||
? {
|
||||
secrets: {
|
||||
collectRuntimeConfigAssignments: telegramSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: telegramAssignments,
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
getBootstrapChannelSecrets: (id: string) =>
|
||||
id === "telegram"
|
||||
? {
|
||||
collectRuntimeConfigAssignments: telegramSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: telegramAssignments,
|
||||
}
|
||||
: undefined,
|
||||
}));
|
||||
|
||||
@@ -5,20 +5,21 @@ const zaloSecrets = loadBundledChannelSecretContractApi("zalo");
|
||||
if (!zaloSecrets?.collectRuntimeConfigAssignments) {
|
||||
throw new Error("Missing Zalo secret contract api");
|
||||
}
|
||||
const zaloAssignments = zaloSecrets.collectRuntimeConfigAssignments;
|
||||
|
||||
vi.mock("../channels/plugins/bootstrap-registry.js", () => ({
|
||||
getBootstrapChannelPlugin: (id: string) =>
|
||||
id === "zalo"
|
||||
? {
|
||||
secrets: {
|
||||
collectRuntimeConfigAssignments: zaloSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: zaloAssignments,
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
getBootstrapChannelSecrets: (id: string) =>
|
||||
id === "zalo"
|
||||
? {
|
||||
collectRuntimeConfigAssignments: zaloSecrets.collectRuntimeConfigAssignments,
|
||||
collectRuntimeConfigAssignments: zaloAssignments,
|
||||
}
|
||||
: undefined,
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user