Browse Source

Merge pull request #2 from lncm/rpcpass-variable-patch

Make bitcoind rcpass more configurable
master 1.0.1
BT 5 years ago
committed by GitHub
parent
commit
b9bd25d02c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      README.md
  2. 10
      switch.sh

3
README.md

@ -16,7 +16,7 @@ docker pull lncm/neutrino-switcher
You may map these anywhere in your filesystem. For best results works best with a similar setup to [this one](https://github.com/lncm/thebox-compose-system) You may map these anywhere in your filesystem. For best results works best with a similar setup to [this one](https://github.com/lncm/thebox-compose-system)
- /secrets/rpcpass.txt (Bitcoin RPC Password) - /secrets/rpcpass.txt (Bitcoin RPC Password. Not used if RPCPASS variable is explicitly defined)
- /lnd/lnd.conf (LND configuration. For best results write access please) - /lnd/lnd.conf (LND configuration. For best results write access please)
- /statuses/ (Write access) - /statuses/ (Write access)
- /var/run/docker.sock (is mapped correctly so it can restart the container) - /var/run/docker.sock (is mapped correctly so it can restart the container)
@ -25,6 +25,7 @@ You may map these anywhere in your filesystem. For best results works best with
Other than that everything should be in the default paths. Other than that everything should be in the default paths.
- RPCPASS (default: whatever is set in /secrets/rpcpass.txt .) - If we set this, we do not need to link rpcpass.txt (this is generated by configure-box.sh by [the box configure script](https://github.com/lncm/thebox-compose-system/blob/master/configure-box.sh))
- JSONRPCURL (Default: http://10.254.2.2:8332) : Is the JSON-RPC interface for bitcoind - JSONRPCURL (Default: http://10.254.2.2:8332) : Is the JSON-RPC interface for bitcoind
- LND_CONTAINER_NAME (Default: lnd) : is the container name to restart - LND_CONTAINER_NAME (Default: lnd) : is the container name to restart
- SLEEPTIME (Default: 3600) : Configures how often to poll. Ideally we should set this high so we minimize disruptions, but we might want to set it lower for testing. - SLEEPTIME (Default: 3600) : Configures how often to poll. Ideally we should set this high so we minimize disruptions, but we might want to set it lower for testing.

10
switch.sh

@ -14,8 +14,12 @@
# Allow access to 'statuses'. /statuses/ # Allow access to 'statuses'. /statuses/
# Output: /statuses/node-status-bitcoind-ready (when ready, where a service can pick it up) # Output: /statuses/node-status-bitcoind-ready (when ready, where a service can pick it up)
# Then
PASSWORD=`cat /secrets/rpcpass.txt`
# if RPCPASS doesn't exist then set it (Default to whats in /secrets/rpcpass.txt)
if [ -z $RPCPASS ]; then
RPCPASS=`cat /secrets/rpcpass.txt`
fi
# If sleeptime isn't set, set it to 3600 (1 hour) # If sleeptime isn't set, set it to 3600 (1 hour)
if [ -z $SLEEPTIME ]; then if [ -z $SLEEPTIME ]; then
@ -37,7 +41,7 @@ while true; do
if [ $IS_NEUTRINO -eq 1 ]; then if [ $IS_NEUTRINO -eq 1 ]; then
echo "If set to neutrino then lets check bitcoind" echo "If set to neutrino then lets check bitcoind"
INFO=`curl --user lncm:$PASSWORD --data-binary '{"jsonrpc": "1.0", "id":"switchme", "method": "getblockchaininfo", "params": [] }' $JSONRPCURL 2>/dev/null` INFO=`curl --user lncm:$RPCPASS --data-binary '{"jsonrpc": "1.0", "id":"switchme", "method": "getblockchaininfo", "params": [] }' $JSONRPCURL 2>/dev/null`
# check for errors # check for errors
ERROR=`echo $INFO | jq .error` ERROR=`echo $INFO | jq .error`
if [ ! -z $ERROR ]; then if [ ! -z $ERROR ]; then

Loading…
Cancel
Save