-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparse-env.sh
77 lines (67 loc) · 1.83 KB
/
parse-env.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
#!/bin/bash
# set -e
if [ -n "$NETWORK_DIR" ]
then
echo "sourcing $scriptDir/$NETWORK_DIR/env.vars"
configDir="$scriptDir/$NETWORK_DIR"
else
echo "set NETWORK_DIR env variable to run"
exit;
fi;
# if there is a fork scheduler then run that first only if this is bootnode
if [ -n "$(ls -A $configDir/fork-scheduler.sh)" ] && ( [ ! -n "$MULTIPEER" ] || [ "$MULTIPEER" == "peer1" ] )
then
source $configDir/fork-scheduler.sh
fi;
echo "network config dir: $configDir"
source "$configDir/fork.vars"
source "$configDir/env.vars"
if [ ! -n "$DATADIR" ]
then
DATADIR="$scriptDir/data"
fi;
mkdir $DATADIR
origDataDir=$DATADIR
elDataDirSource="/data"
clDataDirSource="/data"
# Check if network arg is provided as the name of the geth genesis json file to use to start
# the custom network
if [ ! -n "$NETWORK" ]
then
echo "network not provided via NETWORK env variable, exiting..."
exit;
fi;
if [ ! -n "$JWT_SECRET" ]
then
JWT_SECRET="0xdc6457099f127cf0bac78de8b297df04951281909db4f58b43def7c7151e765d"
fi;
if [ -n "$ELCLIENT" ]
then
if [ ! -n "$ELCLIENT_IMAGE" ] && [ ! -n ELCLIENT_BINARY ]
then
case $ELCLIENT in
ethereumjs)
echo "ELCLIENT=$ELCLIENT using local ethereumjs binary from packages/client"
;;
geth)
if [ ! -n "$NETWORKID" ]
then
echo "geth requires NETWORKID to be passed in env, exiting..."
exit;
fi;
ELCLIENT_IMAGE="ethereum/client-go:stable"
echo "ELCLIENT=$ELCLIENT using ELCLIENT_IMAGE=$ELCLIENT_IMAGE NETWORKID=$NETWORKID"
;;
*)
echo "ELCLIENT=$ELCLIENT not implemented"
esac
fi
else
ELCLIENT="ethereumjs"
echo "ELCLIENT=$ELCLIENT using local ethereumjs binary from packages/client"
fi;
if [ -n ELCLIENT_IMAGE ]
then
echo "pulling latest ELCLIENT_IMAGE=$ELCLIENT_IMAGE"
docker pull $ELCLIENT_IMAGE
fi;