Merge pull request #7 from rfdrake/master

add support for binding to specific interfaces
This commit is contained in:
Chris Miles 2018-03-07 16:25:23 -06:00 committed by GitHub
commit 3406a7c73f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

3
app.js
View File

@ -76,6 +76,7 @@ app.use(function (err, req, res, next) {
}); });
module.exports = app; module.exports = app;
module.exports.glass_config = glass_config;
/** /**
* Global Variables * Global Variables
@ -740,4 +741,4 @@ function email_alert(alert_title, alert_message) {
} }
} }
console.log("[Glass Server] Bootup complete"); console.log("[Glass Server] Bootup complete");

View File

@ -12,7 +12,8 @@ var http = require('http');
* Get port from environment and store in Express. * Get port from environment and store in Express.
*/ */
var port = normalizePort(process.env.PORT || '3000'); var port = normalizePort(process.env.PORT || app.glass_config.port || '3000');
var interface = app.glass_config.host || '0.0.0.0';
app.set('port', port); app.set('port', port);
/** /**
@ -25,7 +26,7 @@ var server = http.createServer(app);
* Listen on provided port, on all network interfaces. * Listen on provided port, on all network interfaces.
*/ */
server.listen(port); server.listen(port, interface);
server.on('error', onError); server.on('error', onError);
server.on('listening', onListening); server.on('listening', onListening);