mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 08:41:13 +00:00
fix: honor googlechat default runtime account
This commit is contained in:
@@ -130,7 +130,9 @@ export function resolveGoogleChatAccount(params: {
|
||||
cfg: OpenClawConfig;
|
||||
accountId?: string | null;
|
||||
}): ResolvedGoogleChatAccount {
|
||||
const accountId = normalizeAccountId(params.accountId);
|
||||
const accountId = normalizeAccountId(
|
||||
params.accountId ?? params.cfg.channels?.["googlechat"]?.defaultAccount,
|
||||
);
|
||||
const baseEnabled = params.cfg.channels?.["googlechat"]?.enabled !== false;
|
||||
const merged = mergeGoogleChatAccountConfig(params.cfg, accountId);
|
||||
const accountEnabled = merged.enabled !== false;
|
||||
|
||||
@@ -489,4 +489,24 @@ describe("resolveGoogleChatAccount", () => {
|
||||
expect(resolved.config.dangerouslyAllowNameMatching).toBeUndefined();
|
||||
expect(resolved.config.audienceType).toBe("app-url");
|
||||
});
|
||||
|
||||
it("uses configured defaultAccount when accountId is omitted", () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
googlechat: {
|
||||
defaultAccount: "alerts",
|
||||
accounts: {
|
||||
alerts: {
|
||||
serviceAccountFile: "/tmp/alerts-sa.json",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const resolved = resolveGoogleChatAccount({ cfg });
|
||||
expect(resolved.accountId).toBe("alerts");
|
||||
expect(resolved.credentialSource).toBe("file");
|
||||
expect(resolved.credentialsFile).toBe("/tmp/alerts-sa.json");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user