From 8e1688adea8ed7f5b74ea28946d98982d726d337 Mon Sep 17 00:00:00 2001 From: Dan Janosik Date: Tue, 9 Apr 2019 14:28:35 -0400 Subject: [PATCH] Fix #111 --- .env-sample | 3 ++- app.js | 8 +++++--- app/credentials.js | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.env-sample b/.env-sample index 6911087..5a95240 100644 --- a/.env-sample +++ b/.env-sample @@ -6,12 +6,13 @@ #BTCEXP_PORT=3002 # Bitcoin RPC Credentials (URI -OR- HOST/PORT/USER/PASS) -#BTCEXP_BITCOIND_URI=bitcoin://rpcusername:rpcpassword@127.0.0.1:8332 +#BTCEXP_BITCOIND_URI=bitcoin://rpcusername:rpcpassword@127.0.0.1:8332?timeout=10000 #BTCEXP_BITCOIND_HOST=localhost #BTCEXP_BITCOIND_PORT=8332 #BTCEXP_BITCOIND_USER=rpcusername #BTCEXP_BITCOIND_PASS=rpcpassword #BTCEXP_BITCOIND_COOKIE=/path/to/bitcoind/.cookie +#BTCEXP_BITCOIND_RPC_TIMEOUT=5000 # Optional ElectrumX Servers, used to display address transaction histories # Ref: https://uasf.saltylemon.org/electrum diff --git a/app.js b/app.js index 9cba5de..d494469 100755 --- a/app.js +++ b/app.js @@ -286,13 +286,15 @@ app.runOnStartup = function() { var rpcCred = config.credentials.rpc; console.log(`Connecting via RPC to node at ${rpcCred.host}:${rpcCred.port}`); - global.client = new bitcoinCore({ + var rpcClientProperties = { host: rpcCred.host, port: rpcCred.port, username: rpcCred.username, password: rpcCred.password, - timeout: 5000 - }); + timeout: rpcCred.timeout + }; + + global.client = new bitcoinCore(rpcClientProperties); if (config.credentials.influxdb.active) { global.influxdb = new Influx.InfluxDB(config.credentials.influxdb); diff --git a/app/credentials.js b/app/credentials.js index bdc6e03..b725370 100644 --- a/app/credentials.js +++ b/app/credentials.js @@ -23,6 +23,7 @@ module.exports = { username: btcAuth[0] || process.env.BTCEXP_BITCOIND_USER, password: btcAuth[1] || process.env.BTCEXP_BITCOIND_PASS, cookie: btcUri.query.cookie || process.env.BTCEXP_BITCOIND_COOKIE || path.join(os.homedir(), '.bitcoin', '.cookie'), + timeout: parseInt(btcUri.query.timeout || process.env.BTCEXP_BITCOIND_RPC_TIMEOUT || 5000), }, influxdb:{