diff --git a/README.md b/README.md index 2057958..5f54d02 100644 --- a/README.md +++ b/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) -- /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) - /statuses/ (Write access) - /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. +- 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 - 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. diff --git a/switch.sh b/switch.sh index 14224f2..465072b 100755 --- a/switch.sh +++ b/switch.sh @@ -14,8 +14,12 @@ # Allow access to 'statuses'. /statuses/ # 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 [ -z $SLEEPTIME ]; then @@ -37,7 +41,7 @@ while true; do if [ $IS_NEUTRINO -eq 1 ]; then 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 ERROR=`echo $INFO | jq .error` if [ ! -z $ERROR ]; then