diff --git a/lib/core/config.js b/lib/core/config.js index c3786efb..ae45b690 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -314,6 +314,7 @@ Config.prototype.loadWebServerConfigFile = function() { var configObject = { "enabled": true, "host": defaultHost, + "openBrowser": true, "port": 8000 }; diff --git a/lib/modules/webserver/index.js b/lib/modules/webserver/index.js index daa1bbe9..664d635f 100644 --- a/lib/modules/webserver/index.js +++ b/lib/modules/webserver/index.js @@ -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}`, diff --git a/templates/boilerplate/config/webserver.js b/templates/boilerplate/config/webserver.js index 1814065d..506490b5 100644 --- a/templates/boilerplate/config/webserver.js +++ b/templates/boilerplate/config/webserver.js @@ -1,5 +1,6 @@ module.exports = { enabled: true, host: "localhost", + openBrowser: true, port: 8000 }; diff --git a/templates/demo/config/webserver.js b/templates/demo/config/webserver.js index 1814065d..506490b5 100644 --- a/templates/demo/config/webserver.js +++ b/templates/demo/config/webserver.js @@ -1,5 +1,6 @@ module.exports = { enabled: true, host: "localhost", + openBrowser: true, port: 8000 };