-
Notifications
You must be signed in to change notification settings - Fork 14
/
entrypoint.sh
80 lines (70 loc) · 2.27 KB
/
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
echo "-- The env vars are below... --"
# notice: set the env vars
if [[ $ENABLE_DEBUG == 'true' ]]
then
export ENABLE_DEBUG='env DEBUG=\*'
echo "ENABLE_DEBUG=${ENABLE_DEBUG}"
else
export ENABLE_DEBUG=""
echo "ENABLE_DEBUG=${ENABLE_DEBUG}"
fi
if [[ $ENABLE_SYNC == 'true' ]]
then
export ENABLE_SYNC="--sync"
echo "ENABLE_SYNC=${ENABLE_SYNC}"
else
export ENABLE_SYNC=""
echo "ENABLE_SYNC=${ENABLE_SYNC}"
fi
if [[ $HEALTHCHECK == 'true' ]]
then
export HEALTHCHECK="--healthCheck"
echo "HEALTHCHECK=${HEALTHCHECK}"
else
export HEALTHCHECK=""
echo "HEALTHCHECK=${HEALTHCHECK}"
fi
if [[ $ENABLE_REPLAY == "undefined" ]]
then
export ENABLE_REPLAY=""
echo "ENABLE_REPLAY=${ENABLE_REPLAY}"
else
export ENABLE_REPLAY="--replay ${ENABLE_REPLAY}"
echo "ENABLE_REPLAY=${ENABLE_REPLAY}"
fi
if [[ $ENABLE_PROCESS_BLOCK_RANGE == 'true' ]]
then
export ENABLE_PROCESS_BLOCK_RANGE="--process-block-range"
echo "ENABLE_PROCESS_BLOCK_RANGE=${ENABLE_PROCESS_BLOCK_RANGE}"
else
export ENABLE_PROCESS_BLOCK_RANGE=""
echo "ENABLE_PROCESS_BLOCK_RANGE=${ENABLE_PROCESS_BLOCK_RANGE}"
fi
if [[ $ENABLE_UNSAFE == 'true' ]] && [[ $HOLOGRAPH_ENVIRONMENT == "mainnet" ]]
then
export ENABLE_UNSAFE='--unsafe'
echo "ENABLE_UNSAFE=${ENABLE_UNSAFE}"
else
export ENABLE_UNSAFE=""
echo "ENABLE_UNSAFE=${ENABLE_UNSAFE}"
fi
#
echo "UPDATE_BLOCK_HEIGHT=${UPDATE_BLOCK_HEIGHT}"
echo "HOLOGRAPH_ENVIRONMENT=${HOLOGRAPH_ENVIRONMENT}"
echo "NETWORK=${NETWORK}"
echo "MODE=${MODE}"
# notice: configure
holograph config --fromFile $CONFIG_FILE
# notice: run the specified app
if [[ $HOLO_CLI_CMD == "operator" ]]
then
eval $ENABLE_DEBUG holograph $HOLO_CLI_CMD --env $HOLOGRAPH_ENVIRONMENT --networks $NETWORK --host=$HOLO_OPERATOR_HOST --mode $MODE $ENABLE_SYNC $HEALTHCHECK --unsafePassword $PASSWORD --update-block-height $UPDATE_BLOCK_HEIGHT $ENABLE_REPLAY $ENABLE_PROCESS_BLOCK_RANGE $ENABLE_UNSAFE
elif [[ $HOLO_CLI_CMD == "indexer" ]]
then
eval $ENABLE_DEBUG holograph $HOLO_CLI_CMD --env $HOLOGRAPH_ENVIRONMENT --networks $NETWORK --host=$HOLO_INDEXER_HOST $HEALTHCHECK $ENABLE_SYNC --update-block-height $UPDATE_BLOCK_HEIGHT $ENABLE_REPLAY $ENABLE_PROCESS_BLOCK_RANGE $ENABLE_UNSAFE
else
echo
echo "-> ERROR...Hey, Should I run as operator, indexer or at least TERMINATOR?"
echo
fi