Browse Source

Merge branch 'enh_dojo_qrcode_explorer' into 'develop'

Add setup of explorer in keys.index.js

See merge request dojo/samourai-dojo!142
use-env-var-docker
kenshin-samourai 5 years ago
parent
commit
178c7df475
  1. 15
      accounts/support-rest-api.js
  2. 28
      docker/my-dojo/node/keys.index.js
  3. 17
      keys/index-example.js

15
accounts/support-rest-api.js

@ -312,20 +312,11 @@ class SupportRestApi {
*/ */
async getPairingExplorer(req, res) { async getPairingExplorer(req, res) {
try { try {
let url = ''
if (process.env.EXPLORER_INSTALL == 'on') {
try {
url = fs.readFileSync('/var/lib/tor/hsv3explorer/hostname', 'utf8')
url = url.replace('\n', '')
} catch(e) {
Logger.error(e, 'API : SupportRestApi.getPairing() : Cannot read explorer onion address')
}
}
const ret = { const ret = {
'pairing': { 'pairing': {
'type': 'explorer.btcRpcExplorer', 'type': `explorer.${keys.explorer.active}`,
'url': url, 'url': keys.explorer.uri,
'key': process.env.EXPLORER_KEY 'key': keys.explorer.password
} }
} }
HttpServer.sendRawData(res, JSON.stringify(ret, null, 2)) HttpServer.sendRawData(res, JSON.stringify(ret, null, 2))

28
docker/my-dojo/node/keys.index.js

@ -2,11 +2,27 @@
* keys/index-example.js * keys/index-example.js
* Copyright (c) 2016-2018, Samourai Wallet (CC BY-NC-ND 4.0 License). * Copyright (c) 2016-2018, Samourai Wallet (CC BY-NC-ND 4.0 License).
*/ */
const fs = require('fs')
// Retrieve active bitcoin network from conf files
const bitcoinNetwork = (process.env.COMMON_BTC_NETWORK == 'testnet') const bitcoinNetwork = (process.env.COMMON_BTC_NETWORK == 'testnet')
? 'testnet' ? 'testnet'
: 'bitcoin' : 'bitcoin'
// Retrieve explorer config from conf files
let explorerActive = 'oxt'
let explorerUrl = 'https://oxt.me'
let explorerPassword = ''
if (process.env.EXPLORER_INSTALL == 'on') {
try {
explorerUrl = fs.readFileSync('/var/lib/tor/hsv3explorer/hostname', 'utf8').replace('\n', '')
explorerPassword = process.env.EXPLORER_KEY
explorerActive = 'btc_rpc_explorer'
} catch(e) {}
}
/** /**
* Desired structure of /keys/index.js, which is ignored in the repository. * Desired structure of /keys/index.js, which is ignored in the repository.
*/ */
@ -180,6 +196,18 @@ module.exports = {
// Esplora (testnet) // Esplora (testnet)
esplora: process.env.NODE_URL_ESPLORA_API, esplora: process.env.NODE_URL_ESPLORA_API,
}, },
/*
* Explorer recommended by this Dojo
*/
explorer: {
// Active explorer
// Values: oxt | btc_rpc_explorer
active: explorerActive,
// URI of the explorer
uri: explorerUrl,
// Password (value required for btc_rpc_explorer)
password: explorerPassword
},
/* /*
* Max number of transactions per address * Max number of transactions per address
* accepted during fast scan * accepted during fast scan

17
keys/index-example.js

@ -174,6 +174,18 @@ module.exports = {
// OXT // OXT
oxt: 'https://api.oxt.me' oxt: 'https://api.oxt.me'
}, },
/*
* Explorer recommended by this Dojo
*/
explorer: {
// Active explorer
// Values: oxt | btc_rpc_explorer
active: 'oxt',
// URI of the explorer
uri: 'https://oxt.me',
// Password (value required for btc_rpc_explorer)
password: '<password>'
},
/* /*
* Max number of transactions per address * Max number of transactions per address
* accepted during fast scan * accepted during fast scan
@ -295,6 +307,11 @@ module.exports = {
socks5Proxy: null, socks5Proxy: null,
esplora: 'https://blockstream.info/testnet' esplora: 'https://blockstream.info/testnet'
}, },
explorer: {
active: 'none',
uri: '',
password: '<password>'
},
addrFilterThreshold: 1000, addrFilterThreshold: 1000,
addrDerivationPool: { addrDerivationPool: {
minNbChildren: 1, minNbChildren: 1,

Loading…
Cancel
Save