openBrowser config option

This commit is contained in:
Michael Bradley, Jr 2018-09-17 17:53:27 -05:00
parent c360975e8f
commit 1b7aed8b80
4 changed files with 7 additions and 0 deletions

View File

@ -314,6 +314,7 @@ Config.prototype.loadWebServerConfigFile = function() {
var configObject = {
"enabled": true,
"host": defaultHost,
"openBrowser": true,
"port": 8000
};

View File

@ -20,6 +20,7 @@ class WebServer {
return;
}
this._openBrowser = this.webServerConfig.openBrowser;
this.events.emit("status", __("Starting Server"));
@ -128,6 +129,9 @@ class WebServer {
}
openBrowser(cb) {
if (!this._openBrowser) {
return cb();
}
const _cb = () => { cb(); };
return opn(
`http://${canonicalHost(this.server.hostname)}:${this.server.port}`,

View File

@ -1,5 +1,6 @@
module.exports = {
enabled: true,
host: "localhost",
openBrowser: true,
port: 8000
};

View File

@ -1,5 +1,6 @@
module.exports = {
enabled: true,
host: "localhost",
openBrowser: true,
port: 8000
};