fix: honor explicit Synology Chat rate-limit env values

Landed from contributor PR #39197 by @scoootscooob.

Co-authored-by: scoootscooob <zhentongfan@gmail.com>
This commit is contained in:
Peter Steinberger
2026-03-08 02:33:52 +00:00
parent 6cb889da8c
commit af9d76b79a
3 changed files with 28 additions and 4 deletions

View File

@@ -130,4 +130,18 @@ describe("resolveAccount", () => {
const account = resolveAccount(cfg);
expect(account.allowedUserIds).toEqual(["u1", "u2"]);
});
it("respects SYNOLOGY_RATE_LIMIT=0 instead of defaulting to 30", () => {
process.env.SYNOLOGY_RATE_LIMIT = "0";
const cfg = { channels: { "synology-chat": {} } };
const account = resolveAccount(cfg);
expect(account.rateLimitPerMinute).toBe(0);
});
it("falls back to 30 for malformed SYNOLOGY_RATE_LIMIT values", () => {
process.env.SYNOLOGY_RATE_LIMIT = "0abc";
const cfg = { channels: { "synology-chat": {} } };
const account = resolveAccount(cfg);
expect(account.rateLimitPerMinute).toBe(30);
});
});