forked from eth-educators/eth-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·61 lines (55 loc) · 1.55 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
if [ "$(id -u)" = '0' ]; then
chown -R geth:geth /var/lib/goethereum
exec su-exec geth docker-entrypoint.sh "$@"
fi
if [ -n "${JWT_SECRET}" ]; then
echo -n "${JWT_SECRET}" > /var/lib/goethereum/ee-secret/jwtsecret
echo "JWT secret was supplied in .env"
fi
if [[ ! -f /var/lib/goethereum/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/goethereum/ee-secret/jwtsecret
fi
if [[ -O "/var/lib/goethereum/ee-secret" ]]; then
# In case someone specificies JWT_SECRET but it's not a distributed setup
chmod 777 /var/lib/goethereum/ee-secret
fi
if [[ -O "/var/lib/goethereum/ee-secret/jwtsecret" ]]; then
chmod 666 /var/lib/goethereum/ee-secret/jwtsecret
fi
# Set verbosity
shopt -s nocasematch
case ${LOG_LEVEL} in
error)
__verbosity="--verbosity 1"
;;
warn)
__verbosity="--verbosity 2"
;;
info)
__verbosity="--verbosity 3"
;;
debug)
__verbosity="--verbosity 4"
;;
trace)
__verbosity="--verbosity 5"
;;
*)
echo "LOG_LEVEL ${LOG_LEVEL} not recognized"
__verbosity=""
;;
esac
if [ -f /var/lib/goethereum/prune-marker ]; then
rm -f /var/lib/goethereum/prune-marker
# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
exec "$@" ${EL_EXTRAS} snapshot prune-state
else
# Word splitting is desired for the command line parameters
# shellcheck disable=SC2086
exec "$@" ${__verbosity} ${EL_EXTRAS}
fi