Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application listening port is configurable #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dev-config.json
Original file line number Diff line number Diff line change
@@ -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
}
3 changes: 2 additions & 1 deletion habitat/config/config.json
Original file line number Diff line number Diff line change
@@ -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 }}"
}
1 change: 1 addition & 0 deletions habitat/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -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);

Expand Down