- backend: HOST env (default 127.0.0.1, dev-safe; 0.0.0.0 in container) - frontend: VITE_BASE drives base/assetsDir/manifest for portal embedding - backward compatible: no env => identical to previous behavior
21 lines
631 B
TypeScript
21 lines
631 B
TypeScript
import { test, expect } from "vitest";
|
|
import { loadConfig } from "../src/config.js";
|
|
|
|
test("loadConfig espone host con default dev-safe 127.0.0.1", () => {
|
|
expect(loadConfig({})).toMatchObject({ host: "127.0.0.1" });
|
|
});
|
|
|
|
test("loadConfig rispetta HOST esplicito (necessario in container)", () => {
|
|
expect(loadConfig({ HOST: "0.0.0.0" })).toMatchObject({ host: "0.0.0.0" });
|
|
});
|
|
|
|
test("loadConfig merge altri campi con l'host", () => {
|
|
expect(
|
|
loadConfig({ HOST: "0.0.0.0", THT_BIN: "/opt/venv/bin/tht", PORT: "9000" })
|
|
).toMatchObject({
|
|
host: "0.0.0.0",
|
|
thtBin: "/opt/venv/bin/tht",
|
|
port: 9000,
|
|
});
|
|
});
|