better config file management
This commit is contained in:
parent
9238db0955
commit
8178205762
12
bitcoind.run
12
bitcoind.run
@ -5,11 +5,21 @@ export HOME="/var/lib/bitcoind"
|
|||||||
# gen random pw for rpc server
|
# gen random pw for rpc server
|
||||||
RANDOMPW=$(openssl rand -hex 10)
|
RANDOMPW=$(openssl rand -hex 10)
|
||||||
|
|
||||||
if [[ ! -e $HOME/bitcoin.conf ]]; then
|
# if password is specified, overwrite config file
|
||||||
|
if [[ "$BITCOIND_RPCPASSWORD" != "" ]]; then
|
||||||
cat <<EOF > $HOME/bitcoin.conf
|
cat <<EOF > $HOME/bitcoin.conf
|
||||||
rpcuser=${BITCOIND_RPCUSER:-rpcuser}
|
rpcuser=${BITCOIND_RPCUSER:-rpcuser}
|
||||||
rpcpassword=${BITCOIND_RPCPASSWORD:-$RANDOMPW}
|
rpcpassword=${BITCOIND_RPCPASSWORD:-$RANDOMPW}
|
||||||
EOF
|
EOF
|
||||||
|
else
|
||||||
|
# if using randomly generated pw, do not overwrite config
|
||||||
|
# if it already exists
|
||||||
|
if [[ ! -e $HOME/bitcoin.conf ]]; then
|
||||||
|
cat <<EOF > $HOME/bitcoin.conf
|
||||||
|
rpcuser=${BITCOIND_RPCUSER:-rpcuser}
|
||||||
|
rpcpassword=$RANDOMPW
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# SECURITY this puts the rpc password into the container log
|
# SECURITY this puts the rpc password into the container log
|
||||||
|
Loading…
Reference in New Issue
Block a user