Moving bitcoin to build role

This commit is contained in:
2024-02-09 19:11:46 -06:00
parent aa68070871
commit 6831ae2cbd
13 changed files with 111 additions and 0 deletions
@@ -0,0 +1,25 @@
#!/bin/bash
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
echo "Creating bitcoin.conf"
# Seed a random password for JSON RPC server
cat <<EOF > $HOME/.bitcoin/bitcoin.conf
regtest=${REGTEST:-0}
disablewallet=${DISABLEWALLET:-1}
printtoconsole=${PRINTTOCONSOLE:-1}
rpcuser=${RPCUSER:-bitcoinrpc}
rpcpassword=${RPCPASSWORD:-`dd if=/dev/urandom bs=33 count=1 2>/dev/null | base64`}
EOF
fi
cat $HOME/.bitcoin/bitcoin.conf
echo "Initialization completed successfully"