Skip to content
This repository was archived by the owner on Aug 30, 2021. It is now read-only.

Commit e6a8f0f

Browse files
committed
Merge pull request #1101 from farajfarook/master
Adding host configuration feature
2 parents 111d85b + 6e4c54f commit e6a8f0f

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

config/env/default.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
googleAnalyticsTrackingID: process.env.GOOGLE_ANALYTICS_TRACKING_ID || 'GOOGLE_ANALYTICS_TRACKING_ID'
99
},
1010
port: process.env.PORT || 3000,
11+
host: process.env.HOST || '0.0.0.0',
1112
templateEngine: 'swig',
1213
// Session Cookie settings
1314
sessionCookie: {

config/env/production.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module.exports = {
77
certificate: './config/sslcerts/cert.pem'
88
},
99
port: process.env.PORT || 8443,
10+
// Binding to 127.0.0.1 is safer in production.
11+
host: process.env.HOST || '0.0.0.0',
1012
db: {
1113
uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/mean',
1214
options: {

config/lib/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ module.exports.start = function start(callback) {
3737

3838
_this.init(function (app, db, config) {
3939

40-
// Start the app by listening on <port>
41-
app.listen(config.port, function () {
40+
// Start the app by listening on <port> at <host>
41+
app.listen(config.port, config.host, function () {
4242

4343
// Logging initialization
4444
console.log('--');

0 commit comments

Comments
 (0)