Skip to content

Commit eb5b8a8

Browse files
committed
chore(sync): snapshot local changes
1 parent 5d4a437 commit eb5b8a8

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
export const OPERATOR_DASHBOARD_PORT = 3000;
2+
3+
export function resolveDashboardPort(
4+
preferred = process.env.PROMPT_REFINER_DASHBOARD_PORT,
5+
legacy = process.env.PORT,
6+
): number {
7+
const configured = preferred || legacy;
8+
if (!configured) {
9+
return OPERATOR_DASHBOARD_PORT;
10+
}
11+
12+
const port = Number.parseInt(configured, 10);
13+
if (!Number.isInteger(port) || port < 1 || port > 65_535) {
14+
return OPERATOR_DASHBOARD_PORT;
15+
}
16+
return port;
17+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { describe, expect, it } from "vitest";
2+
import { OPERATOR_DASHBOARD_PORT, resolveDashboardPort } from "../src/core/ports.js";
3+
4+
describe("dashboard port policy", () => {
5+
it("uses the fixed operator dashboard port by default", () => {
6+
expect(OPERATOR_DASHBOARD_PORT).toBe(3000);
7+
expect(resolveDashboardPort(undefined, undefined)).toBe(3000);
8+
});
9+
10+
it("prefers the named dashboard port over legacy PORT", () => {
11+
expect(resolveDashboardPort("3000", "4321")).toBe(3000);
12+
});
13+
14+
it("keeps legacy PORT as a compatibility fallback and rejects invalid values", () => {
15+
expect(resolveDashboardPort(undefined, "3999")).toBe(3999);
16+
expect(resolveDashboardPort("not-a-port", "3999")).toBe(3000);
17+
expect(resolveDashboardPort("70000", undefined)).toBe(3000);
18+
});
19+
});

0 commit comments

Comments
 (0)