mirror of https://github.com/openclaw/openclaw.git
fix(telegram): Allow ephemeral webhookPort
This commit is contained in:
parent
296210636d
commit
dbfdf60a42
|
|
@ -15,7 +15,7 @@ describe("Telegram webhookPort config", () => {
|
|||
expect(res.ok).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects non-positive webhookPort", () => {
|
||||
it("accepts webhookPort set to 0 for ephemeral port binding", () => {
|
||||
const res = validateConfigObject({
|
||||
channels: {
|
||||
telegram: {
|
||||
|
|
@ -25,6 +25,19 @@ describe("Telegram webhookPort config", () => {
|
|||
},
|
||||
},
|
||||
});
|
||||
expect(res.ok).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects negative webhookPort", () => {
|
||||
const res = validateConfigObject({
|
||||
channels: {
|
||||
telegram: {
|
||||
webhookUrl: "https://example.com/telegram-webhook",
|
||||
webhookSecret: "secret",
|
||||
webhookPort: -1,
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(res.ok).toBe(false);
|
||||
if (!res.ok) {
|
||||
expect(res.issues.some((issue) => issue.path === "channels.telegram.webhookPort")).toBe(true);
|
||||
|
|
|
|||
|
|
@ -193,9 +193,11 @@ export const TelegramAccountSchemaBase = z
|
|||
webhookPort: z
|
||||
.number()
|
||||
.int()
|
||||
.positive()
|
||||
.nonnegative()
|
||||
.optional()
|
||||
.describe("Local bind port for the webhook listener. Defaults to 8787."),
|
||||
.describe(
|
||||
"Local bind port for the webhook listener. Defaults to 8787; set to 0 to let the OS assign an ephemeral port.",
|
||||
),
|
||||
actions: z
|
||||
.object({
|
||||
reactions: z.boolean().optional(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue