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

Commit

Permalink
feat(config): Adding host configuration feature
Browse files Browse the repository at this point in the history
Adding the functionality of configuring the host to bind the server. By
default this is set to 0.0.0.0.
  • Loading branch information
farajfarook committed Dec 22, 2015
1 parent bae0b6b commit 6e4c54f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/env/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 2 additions & 0 deletions config/env/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions config/lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ module.exports.start = function start(callback) {

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

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

// Logging initialization
console.log('--');
Expand Down

0 comments on commit 6e4c54f

Please sign in to comment.