Merge pull request #36 from efi-the-forking-continues/master

new feature: command line option for bind address
This commit is contained in:
Petr Sloup 2016-08-07 20:45:29 +08:00 committed by GitHub
commit afda5d00bc
2 changed files with 7 additions and 1 deletions

View file

@ -8,6 +8,11 @@ var opts = require('nomnom')
default: 'config.json',
help: 'Configuration file'
})
.option('bind', {
abbr: 'b',
default: undefined,
help: 'Bind address'
})
.option('port', {
abbr: 'p',
default: 8080,
@ -24,5 +29,6 @@ var opts = require('nomnom')
return require('./server')({
config: opts.config,
bind: opts.bind,
port: opts.port
});

View file

@ -293,7 +293,7 @@ module.exports = function(opts, callback) {
return data;
});
var server = app.listen(process.env.PORT || opts.port, function() {
var server = app.listen(process.env.PORT || opts.port, process.env.BIND || opts.bind, function() {
console.log('Listening at http://%s:%d/',
this.address().address, this.address().port);