feat: provision non-root Hub service

This commit is contained in:
2026-07-10 15:59:35 +08:00
parent 5f791c5ce4
commit 73fa28a178
19 changed files with 1608 additions and 134 deletions
+23
View File
@@ -0,0 +1,23 @@
import { describe, expect, it } from "vitest";
import { readServerBinding } from "../../src/settings/server.js";
describe("readServerBinding", () => {
it("honors the configured bind host and port", () => {
expect(readServerBinding({ HOST: "127.0.0.2", PORT: "9100" })).toEqual({
host: "127.0.0.2",
port: 9100,
});
});
it.each(["0", "65536", "1.5", "not-a-port"])('rejects invalid PORT="%s"', (port) => {
expect(() => readServerBinding({ HOST: "127.0.0.1", PORT: port })).toThrow(
"PORT must be an integer between 1 and 65535",
);
});
it("rejects a bind URL in place of a host", () => {
expect(() => readServerBinding({ HOST: "https://127.0.0.1", PORT: "8788" })).toThrow(
"HOST must be a hostname or IP address",
);
});
});