Handle (default) case of web server being disabled in file areas/web link generation

This commit is contained in:
Bryan Ashby 2017-02-18 09:56:23 -07:00
parent 701f3c9728
commit 6406d32165
4 changed files with 40 additions and 10 deletions

View file

@ -53,12 +53,12 @@ exports.getModule = class WebServerModule extends ServerModule {
constructor() {
super();
this.enableHttp = Config.contentServers.web.http.enabled || true;
this.enableHttp = Config.contentServers.web.http.enabled || false;
this.enableHttps = Config.contentServers.web.https.enabled || false;
this.routes = {};
if(Config.contentServers.web.staticRoot) {
if(this.isEnabled() && Config.contentServers.web.staticRoot) {
this.addRoute({
method : 'GET',
path : '/static/.*$',
@ -67,6 +67,10 @@ exports.getModule = class WebServerModule extends ServerModule {
}
}
isEnabled() {
return this.enableHttp || this.enableHttps;
}
createServer() {
if(this.enableHttp) {
this.httpServer = http.createServer( (req, resp) => this.routeRequest(req, resp) );