From e50c6128f92f9c2be01a6dfddf577e50bf102c5c Mon Sep 17 00:00:00 2001 From: Stephen Pair Date: Thu, 3 Aug 2017 18:44:49 +0000 Subject: [PATCH] make RPC url configurable --- .gitignore | 4 +++- config.example.js | 1 + lib/rpc.js | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 config.example.js diff --git a/.gitignore b/.gitignore index b512c09..b7d4aa3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -node_modules \ No newline at end of file +node_modules +config.js +package-lock.json diff --git a/config.example.js b/config.example.js new file mode 100644 index 0000000..89152ff --- /dev/null +++ b/config.example.js @@ -0,0 +1 @@ +module.exports.rpcURL = 'http://bitcoin:bitcoin@127.0.0.1:8332'; diff --git a/lib/rpc.js b/lib/rpc.js index ac7fa56..53032fa 100644 --- a/lib/rpc.js +++ b/lib/rpc.js @@ -1,5 +1,6 @@ 'use strict'; var request = require('request'); +var config = require('../config'); var Rpc = function() { @@ -8,13 +9,14 @@ var Rpc = function() { Rpc.prototype.callMethod = function(method, params, callback) { request({ method: 'POST', - url: 'http://bitcoin:bitcoin@127.0.0.1:8332', + url: config.rpcURL, body: { jsonrpc: '1.0', id: Date.now(), method: method, params: params }, + rejectUnauthorized: false, json: true }, function(err, res, body) { if(err) {