Update website.js

Fix exception when not running TLS website frontend.
This commit is contained in:
hellcatz 2017-04-23 11:40:34 -07:00 committed by GitHub
parent cbad5466da
commit 8f942b7c45
1 changed files with 7 additions and 7 deletions

View File

@ -326,12 +326,8 @@ module.exports = function(logger){
res.send(500, 'Something broke!');
});
try {
if (typeof portalConfig.website.tlsOptions !== 'undefined' && !portalConfig.website.tlsOptions.enabled) {
app.listen(portalConfig.website.port, portalConfig.website.host, function () {
logger.debug(logSystem, 'Server', 'Website started on ' + portalConfig.website.host + ':' + portalConfig.website.port);
});
} else {
try {
if (portalConfig.website.tlsOptions && portalConfig.website.tlsOptions.enabled === true) {
var TLSoptions = {
key: fs.readFileSync(portalConfig.website.tlsOptions.key),
cert: fs.readFileSync(portalConfig.website.tlsOptions.cert)
@ -339,7 +335,11 @@ module.exports = function(logger){
https.createServer(TLSoptions, app).listen(portalConfig.website.port, portalConfig.website.host, function() {
logger.debug(logSystem, 'Server', 'TLS Website started on ' + portalConfig.website.host + ':' + portalConfig.website.port);
});
});
} else {
app.listen(portalConfig.website.port, portalConfig.website.host, function () {
logger.debug(logSystem, 'Server', 'Website started on ' + portalConfig.website.host + ':' + portalConfig.website.port);
});
}
}
catch(e){