dist-tests-geth/content/docker-entrypoint.sh
2023-11-15 14:45:07 +01:00

39 lines
1.1 KiB
Bash

UNLOCK_ACCOUNTS=""
if [ -n "$UNLOCK_START_INDEX" ]; then
INDEX=0
END_INDEX=$(($UNLOCK_START_INDEX + $UNLOCK_NUMBER))
while read p; do
if [ "$INDEX" -ge "$UNLOCK_START_INDEX" ]; then
if [ "$INDEX" -lt "$END_INDEX" ]; then
cat passwordsource >> passwordfile
UNLOCK_ACCOUNTS=$(echo $UNLOCK_ACCOUNTS$(echo $p | cut -d ',' -f 1), )
fi
fi
INDEX=$(($INDEX + 1))
done <accounts.csv
UNLOCK_ARGS="--unlock "$UNLOCK_ACCOUNTS" --password passwordfile"
fi
echo "Starting geth..."
PUBLIC_IP_ARGS=""
if [[ "${NAT_PUBLIC_IP_AUTO}" == "true" ]]; then
PUBLIC_IP_ARGS=--nat=extip:$(curl https://ipinfo.io/ip)
fi
if [ -n "$ENABLE_MINER" ]; then
MINER_ARGS="--mine --miner.etherbase 0x10420A3dE36231E12eb601F45b4004311372dcEa"
else
rm -Rf /root/.ethereum/geth
fi
echo "UNLOCK_ARGS: $UNLOCK_ARGS"
echo "MINER_ARGS: $MINER_ARGS"
echo "GETH_ARGS: $GETH_ARGS"
echo "PUBLIC_IP_ARGS: $PUBLIC_IP_ARGS"
geth init genesis.json
geth --networkid 789988 --http --http.addr 0.0.0.0 --allow-insecure-unlock --http.vhosts '*' $UNLOCK_ARGS $MINER_ARGS $PUBLIC_IP_ARGS $GETH_ARGS
exit 0