feat(web): enable automatic port assignment if default is in use (#175)

This commit is contained in:
Bohdan Triapitsyn
2026-01-18 18:18:42 +02:00
committed by GitHub
parent 6c3b653fbd
commit 3df362b220
2 changed files with 131 additions and 83 deletions
+8 -1
View File
@@ -1812,7 +1812,7 @@ async function main(options = {}) {
exitOnShutdown = options.exitOnShutdown;
}
console.log(`Starting OpenChamber on port ${port}`);
console.log(`Starting OpenChamber on port ${port === 0 ? 'auto' : port}`);
const app = express();
expressApp = app;
@@ -4779,6 +4779,13 @@ async function main(options = {}) {
server.off('error', onError);
const addressInfo = server.address();
activePort = typeof addressInfo === 'object' && addressInfo ? addressInfo.port : port;
try {
process.send?.({ type: 'openchamber:ready', port: activePort });
} catch {
// ignore
}
console.log(`OpenChamber server running on port ${activePort}`);
console.log(`Health check: http://localhost:${activePort}/health`);
console.log(`Web interface: http://localhost:${activePort}`);