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 = { var configObject = {
"enabled": true, "enabled": true,
"host": defaultHost, "host": defaultHost,
"openBrowser": true,
"port": 8000 "port": 8000
}; };

View File

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

View File

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

View File

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