mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 11:47:09 +00:00
Allow setting IP to listen on.
Running on bare metal, 127.0.0.1 is a sensible choice of address to bind on, but that is not the case when running inside a container, so we add the ability to choose which IP to listen on. This can be given via the environment variable HTTP_HOST when starting the server or, if used as a module, as the second argument of the start(port, host, path) function.
This commit is contained in:
@@ -13,7 +13,10 @@ async function main () {
|
||||
|
||||
const { fork } = require('child_process');
|
||||
|
||||
const server = api.start(process.env.HTTP_PORT || 3000, process.env.HTTP_PATH);
|
||||
const port = process.env.HTTP_PORT || 3000;
|
||||
const host = process.env.HTTP_HOST || "127.0.0.1";
|
||||
const path = process.env.HTTP_PATH;
|
||||
const server = api.start(port, host, path);
|
||||
ws.start(server);
|
||||
|
||||
const eventManagerPath = [__dirname, "events"].join("/");
|
||||
|
||||
Reference in New Issue
Block a user