init commit
This commit is contained in:
@@ -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"
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
# Generate bitcoin.conf
|
||||
btc_init
|
||||
|
||||
# Default / no argument invocation listens for RPC commands and has to accept non-localhost because of
|
||||
# Docker port proxying or Docker private networking.
|
||||
if [ $# -eq 0 ]; then
|
||||
# If IPv6 is in the container do both:
|
||||
#set -- '-rpcbind=[::]:8332' '-rpcallowip=::/0' '-rpcallowip=0.0.0.0/0'
|
||||
set -- '-rpcbind=:8332' '-rpcallowip=0.0.0.0/0'
|
||||
fi
|
||||
|
||||
exec bitcoind "$@"
|
||||
Reference in New Issue
Block a user