feat(FN-3111): add mesh configuration API routes and generator service
The merge lands the mesh configuration system (FN-3111) with type definitions, a `MeshConfigGenerator` service using a new `DockerClientService.recreateContainer()` method, and backend API routes for managing Docker-based mesh nodes. It also adds a "New Chat" button to the ChatView header on desktop Fusion-Task-Id: FN-3111
This commit is contained in:
@@ -809,6 +809,46 @@ describe("runServe", () => {
|
||||
});
|
||||
await triggerSignal("SIGINT");
|
||||
});
|
||||
|
||||
it("uses process.env.PORT as fallback when no explicit CLI port is given", async () => {
|
||||
const originalPort = process.env.PORT;
|
||||
process.env.PORT = "4041";
|
||||
|
||||
try {
|
||||
await runServe(4040, {});
|
||||
expect(mocks.listenCalls[0]).toMatchObject({
|
||||
port: 4041,
|
||||
host: "127.0.0.1",
|
||||
});
|
||||
await triggerSignal("SIGINT");
|
||||
} finally {
|
||||
if (originalPort !== undefined) {
|
||||
process.env.PORT = originalPort;
|
||||
} else {
|
||||
delete process.env.PORT;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it("ignores process.env.PORT when explicit CLI port is not the default", async () => {
|
||||
const originalPort = process.env.PORT;
|
||||
process.env.PORT = "4041";
|
||||
|
||||
try {
|
||||
await runServe(3000, {});
|
||||
expect(mocks.listenCalls[0]).toMatchObject({
|
||||
port: 3000,
|
||||
host: "127.0.0.1",
|
||||
});
|
||||
await triggerSignal("SIGINT");
|
||||
} finally {
|
||||
if (originalPort !== undefined) {
|
||||
process.env.PORT = originalPort;
|
||||
} else {
|
||||
delete process.env.PORT;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("runServe — Plugin wiring", () => {
|
||||
|
||||
@@ -223,7 +223,16 @@ export async function runServe(
|
||||
serveStartTime = Date.now();
|
||||
ensureProcessDiagnostics();
|
||||
|
||||
// Port resolution priority: CLI --port arg > process.env.PORT > default (4040)
|
||||
// The env var fallback is critical for Docker containers where the mesh config
|
||||
// injects PORT as an environment variable to control the container's listen port.
|
||||
let selectedPort = port;
|
||||
if (!opts.interactive && (port === 4040 || port === 0) && process.env.PORT) {
|
||||
const envPort = Number(process.env.PORT);
|
||||
if (Number.isFinite(envPort) && envPort > 0) {
|
||||
selectedPort = envPort;
|
||||
}
|
||||
}
|
||||
if (opts.interactive) {
|
||||
try {
|
||||
selectedPort = await promptForPort(port);
|
||||
|
||||
Reference in New Issue
Block a user