diff --git a/config/env/default.js b/config/env/default.js index 5f57447c87..2edd28ec33 100644 --- a/config/env/default.js +++ b/config/env/default.js @@ -8,6 +8,7 @@ module.exports = { googleAnalyticsTrackingID: process.env.GOOGLE_ANALYTICS_TRACKING_ID || 'GOOGLE_ANALYTICS_TRACKING_ID' }, port: process.env.PORT || 3000, + host: process.env.HOST || '0.0.0.0', templateEngine: 'swig', // Session Cookie settings sessionCookie: { diff --git a/config/env/production.js b/config/env/production.js index f3094c429a..b878ce988b 100644 --- a/config/env/production.js +++ b/config/env/production.js @@ -7,6 +7,8 @@ module.exports = { certificate: './config/sslcerts/cert.pem' }, port: process.env.PORT || 8443, + // Binding to 127.0.0.1 is safer in production. + host: process.env.HOST || '0.0.0.0', db: { uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/mean', options: { diff --git a/config/lib/app.js b/config/lib/app.js index 42a8f5b420..1f6c4329e9 100644 --- a/config/lib/app.js +++ b/config/lib/app.js @@ -37,8 +37,8 @@ module.exports.start = function start(callback) { _this.init(function (app, db, config) { - // Start the app by listening on - app.listen(config.port, function () { + // Start the app by listening on at + app.listen(config.port, config.host, function () { // Logging initialization console.log('--');