modified btc_init to be freshly generated on each launch

This commit is contained in:
b0xxer 2024-02-10 08:08:09 -06:00
parent 1f14273887
commit f21d5b4f9d

View File

@ -2,50 +2,61 @@
set -ex
# This shouldn't be in the Dockerfile or containers built from the same image
# will have the same credentials.
if [ ! -e "$HOME/.bitcoin/bitcoin.conf" ]; then
mkdir -p $HOME/.bitcoin
mkdir -p $HOME/.bitcoin
echo "Creating bitcoin.conf"
if [ -f "$HOME/.bitcoin/bitcoin.conf" ];
then
echo "Backing up bitcoin.conf"
TMPEXT=$(date +%Y.%m.%d.%H.%M.%S)
mv $HOME/.bitcoin/bitcoin.conf $HOME/.bitcoin/bitcoin.conf.bak.$TMPEXT
fi
echo "Creating bitcoin.conf"
# Seed a random password for JSON RPC server
cat <<EOF > $HOME/.bitcoin/bitcoin.conf
#
#Do not modify this file as it is autogenerated.
#You can either (a) Modify this template "btc_init" in build or
# (b) You can pass a variable name as env variable during container launch
# The variable names are printed to right of each item
#
# Seed a random password for JSON RPC server
cat <<EOF > $HOME/.bitcoin/bitcoin.conf
# network
mainnet=${MAINNET:-1}
testnet=${TESTNET:-0}
regtest=${REGTEST:-0}
mainnet=${MAINNET:-1} # MAINNET
testnet=${TESTNET:-0} # TESTNET
regtest=${REGTEST:-0} # REGTEST
# server
server=${SERVER:-1}
listen=${LISTEN:-1}
listenonion=${LISTENONION:-0}
daemon=${DAEMON:-0}
txindex=${TXINDEX=-1}
prune=${PRUNE=-0}
disablewallet=${DISABLEWALLET:-1}
printtoconsole=${PRINTTOCONSOLE:-1}
server=${SERVER:-1} # SERVER
listen=${LISTEN:-1} # LISTEN
listenonion=${LISTENONION:-0} # LISTENONION
daemon=${DAEMON:-0} # DAEMON
txindex=${TXINDEX=-1} # TXINDEX
prune=${PRUNE=-0} # PRUNE
disablewallet=${DISABLEWALLET:-1} # DISABLEWALLET
printtoconsole=${PRINTTOCONSOLE:-1} # PRINTCONSOLE
# rpc
rpcuser=${RPCUSER:-bitcoinrpc}
rpcpassword=${RPCPASSWORD:-`dd if=/dev/urandom bs=33 count=1 2>/dev/null | base64`}
#rpcconnect=${RPCCONNECT:-127.0.0.1}
#rpcport=${RPCPORT:-8332}
#rpcauth=${RPCAUTH:-xxx}
rpcuser=${RPCUSER:-bitcoinrpc} # RPCUSER
rpcpassword=${RPCPASSWORD:-`dd if=/dev/urandom bs=33 count=1 2>/dev/null | base64`} # RPCPASSWORD
#rpcconnect=${RPCCONNECT:-127.0.0.1} # RPCCONNECT
#rpcport=${RPCPORT:-8332} # RPCPORT
#rpcauth=${RPCAUTH:-xxx} # RPCPORT
# performance
dbcache=${DBCACHE=-2000}
maxconnections=${MAXCONNECTIONS=-40}
maxuploadtarget=${MAXUPLOADTARGET=-5000}
dbcache=${DBCACHE=-2000} # DBCACHE
maxconnections=${MAXCONNECTIONS=-40} # MAXCONNECTIONS
maxuploadtarget=${MAXUPLOADTARGET=-5000} # MAXUPLOADTARGET
# tor
#proxy=${PROXY:-127.0.0.1:9050}
#seednode=${SEEDNODE1:-nkf5e6b7pl4jfd4a.onion}
#seednode=${SEEDNODE2:-xqzfakpeuvrobvpj.onion}
#seednode=${SEEDNODE3:-tsyvzsqwa2kkf6b2.onion}
#proxy=${PROXY:-127.0.0.1:9050} # PROXY
#seednode=${SEEDNODE1:-nkf5e6b7pl4jfd4a.onion} # SEEDNODE1
#seednode=${SEEDNODE2:-xqzfakpeuvrobvpj.onion} # SEEDNODE2
#seednode=${SEEDNODE3:-tsyvzsqwa2kkf6b2.onion} # SEEDNODE3
# validation
reindex-chainstate=${REINDEXCHAINSTATE=-0}
reindex-chainstate=${REINDEXCHAINSTATE=-0} # REINDEXCHAINSTATE
EOF