From 53c1ef5786d62a55c87ebbe5f2a9681042a14cdc Mon Sep 17 00:00:00 2001 From: Thomas Efer Date: Fri, 5 Aug 2016 14:28:34 +0200 Subject: [PATCH 1/3] Added option to specify network interface binding --- src/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.js b/src/main.js index 29d1815..4fca184 100644 --- a/src/main.js +++ b/src/main.js @@ -8,6 +8,11 @@ var opts = require('nomnom') default: 'config.json', help: 'Configuration file' }) + .option('bind', { + abbr: 'b', + default: "::", + 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 }); From aa9a469bb4e1be496f82a76478554e7f116fa81b Mon Sep 17 00:00:00 2001 From: Thomas Efer Date: Fri, 5 Aug 2016 14:30:22 +0200 Subject: [PATCH 2/3] tell server to adhere to new option for network interface binding --- src/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.js b/src/server.js index bb5d000..af579a4 100644 --- a/src/server.js +++ b/src/server.js @@ -284,7 +284,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); From b3cb047d3d8264d358ac2ad2235b3b7293356433 Mon Sep 17 00:00:00 2001 From: Thomas Efer Date: Sun, 7 Aug 2016 11:34:46 +0200 Subject: [PATCH 3/3] set default binding to undefined this will result in default behavior in app.listen within server.js --- src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.js b/src/main.js index 4fca184..34df437 100644 --- a/src/main.js +++ b/src/main.js @@ -10,7 +10,7 @@ var opts = require('nomnom') }) .option('bind', { abbr: 'b', - default: "::", + default: undefined, help: 'Bind address' }) .option('port', {