check port for webserver, if in use ++ port
This commit is contained in:
parent
fa551f67a3
commit
a38c317ecd
|
@ -17,14 +17,20 @@ class WebServer {
|
|||
this.port = options.port || this.webServerConfig.port;
|
||||
|
||||
this.events.emit("status", __("Starting Server"));
|
||||
|
||||
utils.pingEndpoint(this.host, this.port, 'http', 'http', '', (err) => {
|
||||
if (!err) { // Port already in use
|
||||
this.logger.warn(__('Webserver already running on port {{oldPort}}. Trying to connect on {{newPort}}',
|
||||
{oldPort: this.port, newPort: this.port + 1}));
|
||||
this.port++;
|
||||
}
|
||||
this.server = new Server({host: this.host, port: this.port});
|
||||
|
||||
this.setServiceCheck();
|
||||
this.listenToCommands();
|
||||
this.registerConsoleCommands();
|
||||
|
||||
let self = this;
|
||||
this.server.start((_err, message) => self.logger.info(message));
|
||||
this.server.start((_err, message) => this.logger.info(message));
|
||||
});
|
||||
}
|
||||
|
||||
setServiceCheck() {
|
||||
|
|
Loading…
Reference in New Issue