-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker_entrypoint.sh
46 lines (40 loc) · 906 Bytes
/
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
#!/bin/bash
USAGE="Usage: docker_entrypoint.sh [--address=HOST:PORT] [-- command]"
# Default address is localhost (127.0.0.1)
# Default command is seen below
DEFAULT_CMD="./bin/blockbook -blockchaincfg=config/blockchaincfg.json -datadir=db -sync -internal=:9172 -public=:9272 -explorer= -log_dir=logs -dbcache=1073741824 -resyncindexperiod=4000"
DEFAULT_ADDRESS="127.0.0.1:8172"
CMD=${DEFAULT_CMD}
ADDRESS=${DEFAULT_ADDRESS}
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--address)
ADDRESS="$2"
shift
shift
;;
--address=*)
ADDRESS="${key#*=}"
shift
;;
-h|--help)
echo ${USAGE}
exit 0
;;
--)
shift
CMD="$@"
break
;;
*)
echo "Unknown argument, $1 exiting"
echo ${USAGE}
exit 1
;;
esac
done
echo $ADDRESS
sed -i 's/"rpc_url": "[^\"].*"/"rpc_url": "http:\/\/'${ADDRESS}'"/' config/blockchaincfg.json
eval ${CMD}