Added more variables to btc_init to create full bitcoin.conf file

This commit is contained in:
b0xxer 2024-02-10 07:25:40 -06:00
parent ca61e1c922
commit f502702cbc
3 changed files with 57 additions and 28 deletions

View File

@ -0,0 +1,56 @@
#!/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
# network
mainnet=${MAINNET:-1}
testnet=${TESTNET:-0}
regtest=${REGTEST:-0}
# 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}
# 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}
# performance
dbcache=${DBCACHE=-2000}
maxconnections=${MAXCONNECTIONS=-40}
maxuploadtarget=${MAXUPLOADTARGET=-5000}
# tor
#proxy=${PROXY:-127.0.0.1:9050}
#seednode=${SEEDNODE1:-nkf5e6b7pl4jfd4a.onion}
#seednode=${SEEDNODE2:-xqzfakpeuvrobvpj.onion}
#seednode=${SEEDNODE3:-tsyvzsqwa2kkf6b2.onion}
# validation
reindex-chainstate=${REINDEXCHAINSTATE=-0}
EOF
fi
cat $HOME/.bitcoin/bitcoin.conf
echo "Initialization completed successfully"

View File

@ -1,25 +0,0 @@
#!/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"

View File

@ -35,7 +35,7 @@
- cockpit-podman - cockpit-podman
- zerotier-one - zerotier-one
- name: Reboot System - name: Reboot System
become: yes become: yes
become_method: sudo become_method: sudo
ansible.builtin.reboot: ansible.builtin.reboot:
@ -43,5 +43,3 @@
when: reboot_status['changed']==True when: reboot_status['changed']==True