Make production listener configurable
This commit is contained in:
@@ -12,7 +12,12 @@ const execAsync = promisify(exec);
|
||||
|
||||
async function startServer() {
|
||||
const app = express();
|
||||
const PORT = 3000;
|
||||
const port = Number.parseInt(process.env.PORT ?? "3000", 10);
|
||||
const host = process.env.HOST ?? "0.0.0.0";
|
||||
|
||||
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
||||
throw new Error(`Invalid PORT value: ${process.env.PORT}`);
|
||||
}
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
@@ -756,8 +761,8 @@ async function startServer() {
|
||||
});
|
||||
}
|
||||
|
||||
app.listen(PORT, "0.0.0.0", () => {
|
||||
console.log(`Labyricorn Control Plane running on http://0.0.0.0:${PORT}`);
|
||||
app.listen(port, host, () => {
|
||||
console.log(`Labyricorn Control Plane running on http://${host}:${port}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user