mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 05:01:15 +00:00
fix: honor matrix default runtime account
This commit is contained in:
@@ -218,6 +218,29 @@ describe("resolveMatrixAccount", () => {
|
||||
expect(resolveDefaultMatrixAccountId(cfg)).toBe("ops");
|
||||
});
|
||||
|
||||
it("uses configured defaultAccount when accountId is omitted", () => {
|
||||
const cfg: CoreConfig = {
|
||||
channels: {
|
||||
matrix: {
|
||||
defaultAccount: "ops",
|
||||
homeserver: "https://matrix.example.org",
|
||||
accessToken: "default-token",
|
||||
accounts: {
|
||||
ops: {
|
||||
homeserver: "https://ops.example.org",
|
||||
accessToken: "ops-token",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const account = resolveMatrixAccount({ cfg });
|
||||
expect(account.accountId).toBe("ops");
|
||||
expect(account.homeserver).toBe("https://ops.example.org");
|
||||
expect(account.configured).toBe(true);
|
||||
});
|
||||
|
||||
it("includes env-backed named accounts in plugin account enumeration", () => {
|
||||
const keys = getMatrixScopedEnvVarNames("team-ops");
|
||||
process.env[keys.homeserver] = "https://matrix.example.org";
|
||||
|
||||
@@ -179,7 +179,9 @@ export function resolveMatrixAccount(params: {
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}): ResolvedMatrixAccount {
|
||||
const env = params.env ?? process.env;
|
||||
const accountId = normalizeAccountId(params.accountId);
|
||||
const accountId = normalizeAccountId(
|
||||
params.accountId ?? resolveDefaultMatrixAccountId(params.cfg),
|
||||
);
|
||||
const matrixBase = resolveMatrixBaseConfig(params.cfg);
|
||||
const base = resolveMatrixAccountConfig({ cfg: params.cfg, accountId, env });
|
||||
const explicitAuthConfig =
|
||||
|
||||
Reference in New Issue
Block a user