mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 16:20:20 +00:00
fix: honor line default runtime account
This commit is contained in:
@@ -103,6 +103,32 @@ describe("LINE accounts", () => {
|
||||
expect(account.name).toBe("Business Bot");
|
||||
});
|
||||
|
||||
it("uses configured defaultAccount when accountId is omitted", () => {
|
||||
const cfg: OpenClawConfig = {
|
||||
channels: {
|
||||
line: {
|
||||
defaultAccount: "business",
|
||||
accounts: {
|
||||
business: {
|
||||
enabled: true,
|
||||
channelAccessToken: "business-token",
|
||||
channelSecret: "business-secret",
|
||||
name: "Business Bot",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const account = resolveLineAccount({ cfg });
|
||||
|
||||
expect(account.accountId).toBe("business");
|
||||
expect(account.enabled).toBe(true);
|
||||
expect(account.channelAccessToken).toBe("business-token");
|
||||
expect(account.channelSecret).toBe("business-secret");
|
||||
expect(account.name).toBe("Business Bot");
|
||||
});
|
||||
|
||||
it("returns empty token when not configured", () => {
|
||||
const cfg: OpenClawConfig = {};
|
||||
|
||||
|
||||
@@ -94,7 +94,9 @@ export function resolveLineAccount(params: {
|
||||
accountId?: string;
|
||||
}): ResolvedLineAccount {
|
||||
const cfg = params.cfg;
|
||||
const accountId = normalizeSharedAccountId(params.accountId);
|
||||
const accountId = normalizeSharedAccountId(
|
||||
params.accountId ?? resolveDefaultLineAccountId(cfg),
|
||||
);
|
||||
const lineConfig = cfg.channels?.line as LineConfig | undefined;
|
||||
const accounts = lineConfig?.accounts;
|
||||
const accountConfig =
|
||||
|
||||
Reference in New Issue
Block a user