diff --git a/dev-config.json b/dev-config.json index 4fb4d5da..5bea2d9b 100644 --- a/dev-config.json +++ b/dev-config.json @@ -1,4 +1,5 @@ { "title": "Habitat - The fastest path from code to cloud native.", - "message": "Welcome to the Habitat Node.js sample app." + "message": "Welcome to the Habitat Node.js sample app.", + "port": 8000 } diff --git a/habitat/config/config.json b/habitat/config/config.json index 738a061f..04da6d72 100644 --- a/habitat/config/config.json +++ b/habitat/config/config.json @@ -1,4 +1,5 @@ { "title": "{{ cfg.title }}", - "message": "You are running version {{ pkg.version }} of the Habitat Node.js sample app." + "message": "You are running version {{ pkg.version }} of the Habitat Node.js sample app.", + "port": "{{ cfg.port }}" } diff --git a/habitat/default.toml b/habitat/default.toml index 3adb38db..c446ec7f 100644 --- a/habitat/default.toml +++ b/habitat/default.toml @@ -5,3 +5,4 @@ # https://www.habitat.sh/docs/developing-packages/#add-configuration. title = "Habitat - The fastest path from code to cloud native." +port = 8000 diff --git a/index.js b/index.js index 7059a047..f7bc3ea9 100755 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ var app = require('./app'); var http = require('http'); -var port = process.env.PORT || 8000; +var nconf = require('nconf'); +var port = process.env.PORT || nconf.get('port') || 8000; app.set('port', port);