mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 17:24:32 +00:00
fix(gateway): honor insecure ws override for remote hostnames
This commit is contained in:
@@ -132,6 +132,27 @@ describe("promptRemoteGatewayConfig", () => {
|
||||
expect(next.gateway?.remote?.token).toBeUndefined();
|
||||
});
|
||||
|
||||
it("allows ws:// hostname remote URLs when OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1", async () => {
|
||||
process.env.OPENCLAW_ALLOW_INSECURE_PRIVATE_WS = "1";
|
||||
const text: WizardPrompter["text"] = vi.fn(async (params) => {
|
||||
if (params.message === "Gateway WebSocket URL") {
|
||||
expect(params.validate?.("ws://openclaw-gateway.ai:18789")).toBeUndefined();
|
||||
expect(params.validate?.("ws://1.1.1.1:18789")).toContain("Use wss://");
|
||||
return "ws://openclaw-gateway.ai:18789";
|
||||
}
|
||||
return "";
|
||||
}) as WizardPrompter["text"];
|
||||
|
||||
const { next } = await runRemotePrompt({
|
||||
text,
|
||||
confirm: false,
|
||||
selectResponses: { "Gateway auth": "off" },
|
||||
});
|
||||
|
||||
expect(next.gateway?.mode).toBe("remote");
|
||||
expect(next.gateway?.remote?.url).toBe("ws://openclaw-gateway.ai:18789");
|
||||
});
|
||||
|
||||
it("supports storing remote auth as an external env secret ref", async () => {
|
||||
process.env.OPENCLAW_GATEWAY_TOKEN = "remote-token-value";
|
||||
const text: WizardPrompter["text"] = vi.fn(async (params) => {
|
||||
|
||||
Reference in New Issue
Block a user