From bf5e981db969d2c19831d0db91c06484a16f1935 Mon Sep 17 00:00:00 2001 From: nolim1t Date: Wed, 8 Jul 2020 16:25:44 +0700 Subject: [PATCH] change PASSWORD to RPCPASS. Make it a variable which can be set too --- switch.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/switch.sh b/switch.sh index cd74b9e..6504840 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 JSONRPCURL doesn't exist then set it if [ -z $JSONRPCURL ]; then @@ -32,7 +36,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