feat(web): enable automatic port assignment if default is in use (#175)
This commit is contained in:
committed by
GitHub
parent
6c3b653fbd
commit
3df362b220
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user