From 614ed5b08026cff54fb2f78da3ac667e27311148 Mon Sep 17 00:00:00 2001 From: Nadav Ivgi Date: Sat, 9 Feb 2019 17:16:32 +0200 Subject: [PATCH] Allow configuring HTTP server bind address via BTCEXP_HOST --- bin/cli.js | 3 ++- bin/www | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/cli.js b/bin/cli.js index 7c0000f..1b212c3 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -6,6 +6,7 @@ const args = require('meow')(` Options -p, --port port to bind http server [default: 3002] + -i, --host host to bind http server [default: 127.0.0.1] -a, --basic-auth-password <..> protect web interface with a password [default: no password] -C, --coin crypto-coin to enable [default: BTC] @@ -53,7 +54,7 @@ const args = require('meow')(` $ BTCEXP_PORT=8080 BTCEXP_BITCOIND_PORT=18443 BTCEXP_BITCOIND_COOKIE=~/.bitcoin/regtest/.cookie btc-rpc-explorer -`, { flags: { port: {alias:'p'}, basicAuthPassword: {alias:'a'}, coin: {alias:'C'} +`, { flags: { port: {alias:'p'}, host: {alias:'i'}, basicAuthPassword: {alias:'a'}, coin: {alias:'C'} , bitcoindUri: {alias:'b'}, bitcoindHost: {alias:'H'}, bitcoindPort: {alias:'P'} , bitcoindCookie: {alias:'c'}, bitcoindUser: {alias:'u'}, bitcoindPass: {alias:'w'} , demo: {type:'boolean'}, rpcAllowall: {type:'boolean'}, electrumxServers: {alias:'E'} diff --git a/bin/www b/bin/www index c46aed3..db7958c 100644 --- a/bin/www +++ b/bin/www @@ -3,9 +3,10 @@ var debug = require('debug')('my-application'); var app = require('../app'); app.set('port', process.env.PORT || process.env.BTCEXP_PORT || 3002); +app.set('host', process.env.BTCEXP_HOST || '127.0.0.1'); -var server = app.listen(app.get('port'), function() { - debug('Express server listening on port ' + server.address().port); +var server = app.listen(app.get('port'), app.get('host'), function() { + debug('Express server listening on ' + server.address().address + ':' + server.address().port); if (app.runOnStartup) { app.runOnStartup();