server.listen bind to ipv6 too
This commit is contained in:
		
							parent
							
								
									5512b15162
								
							
						
					
					
						commit
						d6fad7f1ef
					
				
					 1 changed files with 11 additions and 2 deletions
				
			
		|  | @ -40,7 +40,10 @@ const passwordHash = require("./password-hash"); | |||
| const args = require("args-parser")(process.argv); | ||||
| 
 | ||||
| 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); | ||||
| 
 | ||||
| console.info("Version: " + version) | ||||
|  | @ -568,7 +571,13 @@ let indexHTML = fs.readFileSync("./dist/index.html").toString(); | |||
| 
 | ||||
|     console.log("Init") | ||||
|     server.listen(port, hostname, () => { | ||||
| 
 | ||||
|         if (hostname) { | ||||
|             console.log(`Listening on ${hostname}:${port}`); | ||||
|         } else { | ||||
|             console.log("Listening on ${port}"); | ||||
|         } | ||||
| 
 | ||||
|         startMonitors(); | ||||
|     }); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue