mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-03 06:48:23 +00:00
fix: align gateway run auth modes (#27469) (thanks @s1korrrr)
This commit is contained in:
@@ -18,7 +18,7 @@ const runGatewayLoop = vi.fn(async ({ start }: { start: () => Promise<unknown> }
|
||||
await start();
|
||||
});
|
||||
|
||||
const { defaultRuntime, resetRuntimeCapture } = createCliRuntimeCapture();
|
||||
const { runtimeErrors, defaultRuntime, resetRuntimeCapture } = createCliRuntimeCapture();
|
||||
|
||||
vi.mock("../../config/config.js", () => ({
|
||||
getConfigPath: () => "/tmp/openclaw-test-missing-config.json",
|
||||
@@ -152,4 +152,40 @@ describe("gateway run option collisions", () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("accepts --auth none override", async () => {
|
||||
await runGatewayCli(["gateway", "run", "--auth", "none", "--allow-unconfigured"]);
|
||||
|
||||
expect(startGatewayServer).toHaveBeenCalledWith(
|
||||
18789,
|
||||
expect.objectContaining({
|
||||
auth: expect.objectContaining({
|
||||
mode: "none",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("accepts --auth trusted-proxy override", async () => {
|
||||
await runGatewayCli(["gateway", "run", "--auth", "trusted-proxy", "--allow-unconfigured"]);
|
||||
|
||||
expect(startGatewayServer).toHaveBeenCalledWith(
|
||||
18789,
|
||||
expect.objectContaining({
|
||||
auth: expect.objectContaining({
|
||||
mode: "trusted-proxy",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("prints all supported modes on invalid --auth value", async () => {
|
||||
await expect(
|
||||
runGatewayCli(["gateway", "run", "--auth", "bad-mode", "--allow-unconfigured"]),
|
||||
).rejects.toThrow("__exit__:1");
|
||||
|
||||
expect(runtimeErrors).toContain(
|
||||
'Invalid --auth (use "none", "token", "password", or "trusted-proxy")',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user