server.listen bind to ipv6 too

pull/200/head
LouisLam 3 years ago
parent 5512b15162
commit d6fad7f1ef

@ -40,7 +40,10 @@ const passwordHash = require("./password-hash");
const args = require("args-parser")(process.argv); const args = require("args-parser")(process.argv);
const version = require("../package.json").version; const version = require("../package.json").version;
const hostname = process.env.HOST || args.host || "0.0.0.0"
// If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available, or the unspecified IPv4 address (0.0.0.0) otherwise.
const hostname = process.env.HOST || args.host;
const port = parseInt(process.env.PORT || args.port || 3001); const port = parseInt(process.env.PORT || args.port || 3001);
console.info("Version: " + version) console.info("Version: " + version)
@ -568,7 +571,13 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString();
console.log("Init") console.log("Init")
server.listen(port, hostname, () => { server.listen(port, hostname, () => {
if (hostname) {
console.log(`Listening on ${hostname}:${port}`); console.log(`Listening on ${hostname}:${port}`);
} else {
console.log("Listening on ${port}");
}
startMonitors(); startMonitors();
}); });

Loading…
Cancel
Save