forked from eth-educators/eth-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·37 lines (31 loc) · 1.03 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -Eeuo pipefail
if [ "$(id -u)" = '0' ]; then
chown -R besu:besu /var/lib/besu
exec gosu besu "$BASH_SOURCE" "$@"
fi
if [ -n "${JWT_SECRET}" ]; then
echo -n ${JWT_SECRET} > /var/lib/besu/ee-secret/jwtsecret
echo "JWT secret was supplied in .env"
fi
if [[ ! -f /var/lib/besu/ee-secret/jwtsecret ]]; then
echo "Generating JWT secret"
__secret1=$(echo $RANDOM | md5sum | head -c 32)
__secret2=$(echo $RANDOM | md5sum | head -c 32)
echo -n ${__secret1}${__secret2} > /var/lib/besu/ee-secret/jwtsecret
fi
if [[ -O "/var/lib/besu/ee-secret" ]]; then
# In case someone specificies JWT_SECRET but it's not a distributed setup
chmod 777 /var/lib/besu/ee-secret
fi
if [[ -O "/var/lib/besu/ee-secret/jwtsecret" ]]; then
chmod 666 /var/lib/besu/ee-secret/jwtsecret
fi
# Check whether we should override TTD
if [ -n "${OVERRIDE_TTD}" ]; then
__override_ttd="--override-genesis-config=terminalTotalDifficulty=${OVERRIDE_TTD}"
echo "Overriding TTD to ${OVERRIDE_TTD}"
else
__override_ttd=""
fi
exec "$@" ${__override_ttd}