Browse Source

Fix #111

fix-133-memory-crash
Dan Janosik 6 years ago
parent
commit
8e1688adea
No known key found for this signature in database GPG Key ID: C6F8CE9FFDB2CED2
  1. 3
      .env-sample
  2. 8
      app.js
  3. 1
      app/credentials.js

3
.env-sample

@ -6,12 +6,13 @@
#BTCEXP_PORT=3002 #BTCEXP_PORT=3002
# Bitcoin RPC Credentials (URI -OR- HOST/PORT/USER/PASS) # 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_HOST=localhost
#BTCEXP_BITCOIND_PORT=8332 #BTCEXP_BITCOIND_PORT=8332
#BTCEXP_BITCOIND_USER=rpcusername #BTCEXP_BITCOIND_USER=rpcusername
#BTCEXP_BITCOIND_PASS=rpcpassword #BTCEXP_BITCOIND_PASS=rpcpassword
#BTCEXP_BITCOIND_COOKIE=/path/to/bitcoind/.cookie #BTCEXP_BITCOIND_COOKIE=/path/to/bitcoind/.cookie
#BTCEXP_BITCOIND_RPC_TIMEOUT=5000
# Optional ElectrumX Servers, used to display address transaction histories # Optional ElectrumX Servers, used to display address transaction histories
# Ref: https://uasf.saltylemon.org/electrum # Ref: https://uasf.saltylemon.org/electrum

8
app.js

@ -286,13 +286,15 @@ app.runOnStartup = function() {
var rpcCred = config.credentials.rpc; var rpcCred = config.credentials.rpc;
console.log(`Connecting via RPC to node at ${rpcCred.host}:${rpcCred.port}`); console.log(`Connecting via RPC to node at ${rpcCred.host}:${rpcCred.port}`);
global.client = new bitcoinCore({ var rpcClientProperties = {
host: rpcCred.host, host: rpcCred.host,
port: rpcCred.port, port: rpcCred.port,
username: rpcCred.username, username: rpcCred.username,
password: rpcCred.password, password: rpcCred.password,
timeout: 5000 timeout: rpcCred.timeout
}); };
global.client = new bitcoinCore(rpcClientProperties);
if (config.credentials.influxdb.active) { if (config.credentials.influxdb.active) {
global.influxdb = new Influx.InfluxDB(config.credentials.influxdb); global.influxdb = new Influx.InfluxDB(config.credentials.influxdb);

1
app/credentials.js

@ -23,6 +23,7 @@ module.exports = {
username: btcAuth[0] || process.env.BTCEXP_BITCOIND_USER, username: btcAuth[0] || process.env.BTCEXP_BITCOIND_USER,
password: btcAuth[1] || process.env.BTCEXP_BITCOIND_PASS, password: btcAuth[1] || process.env.BTCEXP_BITCOIND_PASS,
cookie: btcUri.query.cookie || process.env.BTCEXP_BITCOIND_COOKIE || path.join(os.homedir(), '.bitcoin', '.cookie'), 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:{ influxdb:{

Loading…
Cancel
Save