21centurymotorcompany / bitd

DEPRECATED. Replaced with Planaria https://planaria.network
82 stars 38 forks source link

RPC settings not honored #1

Closed OverlordQ closed 6 years ago

OverlordQ commented 6 years ago

It looks like that the TNA module doesn't utilize the credentials specified in the config file, but rather looks at environment variables.

 var fromHash = function(hash) {
   const RpcClient = require('bitcoind-rpc');
   const rpc = new RpcClient({
     protocol: 'http',
     user: process.env.BITCOIN_USERNAME ? process.env.BITCOIN_USERNAME : 'root',
     pass: process.env.BITCOIN_PASSWORD ? process.env.BITCOIN_PASSWORD : 'bitcoin',
     host: process.env.BITCOIN_IP ? process.env.BITCOIN_IP : '127.0.0.1',
     port: process.env.BITCOIN_PORT ? process.env.BITCOIN_PORT : '8332',
   })

So the Init needs something like:

    process.env.BITCOIN_USERNAME = Config.rpc.user;
    process.env.BITCOIN_PASSWORD = Config.rpc.pass;
    process.env.BITCOIN_IP = Config.rpc.host;
    process.env.BITCOIN_PORT = Config.rpc.port;
unwriter commented 6 years ago

I just TNA so that it accepts a second "config" argument https://github.com/21centurymotorcompany/tna/commit/e281473caeb9e0bcd6fee01b9a8fc961c2f291c0

And then updated this repo to support the new version of TNA https://github.com/21centurymotorcompany/bitd/commit/aa27a1a8d9eea43044599e9f52064e84dc537abf

Thanks for the heads up! Feel free to reopen if something doesn't feel right