-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathparse-env.sh
More file actions
executable file
·150 lines (141 loc) · 3.45 KB
/
parse-env.sh
File metadata and controls
executable file
·150 lines (141 loc) · 3.45 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/bin/bash
# set -e
if [ -n "$NETWORK_DIR" ]
then
echo "setting up network from $scriptDir/$NETWORK_DIR"
configDir="$scriptDir/$NETWORK_DIR/genesis"
dataDir="$scriptDir/$NETWORK_DIR/data"
else
echo "set NETWORK_DIR env variable to run"
exit
fi;
# TODO: check for presense of all required files by filenames on configDir
if [ ! -n "$(ls -A $configDir)" ]
then
echo "no genesis config at path=$configDir, exiting."
exit
fi;
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--node)
node="$2"
shift # past argument
shift # past value
;;
--validatorConfig)
validatorConfig="$2"
shift # past argument
shift # past value
;;
--forceKeyGen)
# to be passed to genesis generator
FORCE_KEYGEN_FLAG="--forceKeyGen"
shift
;;
--cleanData)
cleanData=true
shift # past argument
;;
--popupTerminal)
popupTerminal=true
shift # past argument
;;
--dockerWithSudo)
dockerWithSudo=true
shift # past argument
;;
--metrics)
enableMetrics=true
shift # past argument
;;
--generateGenesis)
generateGenesis=true
cleanData=true # generateGenesis implies clean data
shift # past argument
;;
--deploymentMode)
deploymentMode="$2"
shift # past argument
shift # past value
;;
--sshKey|--private-key)
sshKeyFile="$2"
shift # past argument
shift # past value
;;
--useRoot)
useRoot=true
shift
;;
--tag)
dockerTag="$2"
shift # past argument
shift # past value
;;
--stop)
stopNodes=true
shift
;;
--aggregator)
aggregatorNode="$2"
shift # past argument
shift # past value
;;
--checkpoint-sync-url)
checkpointSyncUrl="$2"
shift
shift
;;
--restart-client)
restartClient="$2"
shift
shift
;;
--coreDumps)
coreDumps="$2"
shift # past argument
shift # past value
;;
--skip-leanpoint)
skipLeanpoint=true
shift
;;
--prepare)
prepareMode=true
shift
;;
*) # unknown option
shift # past argument
;;
esac
done
# if no node and no restart-client specified, exit (unless --prepare mode)
if [[ ! -n "$node" ]] && [[ ! -n "$restartClient" ]] && [[ "$prepareMode" != "true" ]];
then
echo "no node or restart-client specified, exiting..."
exit
fi;
# When using --restart-client with checkpoint sync, set default checkpoint URL if not provided
if [[ -n "$restartClient" ]] && [[ ! -n "$checkpointSyncUrl" ]]; then
checkpointSyncUrl="https://leanpoint.leanroadmap.org/lean/v0/states/finalized"
fi;
if [ ! -n "$validatorConfig" ]
then
echo "no external validator config provided, assuming genesis bootnode"
validatorConfig="genesis_bootnode"
fi;
# freshStart logic removed - now handled by --generateGenesis flag
echo "configDir = $configDir"
echo "dataDir = $dataDir"
echo "spin_nodes(s) = ${spin_nodes[@]}"
echo "generateGenesis = $generateGenesis"
echo "cleanData = $cleanData"
echo "popupTerminal = $popupTerminal"
echo "dockerTag = ${dockerTag:-latest}"
echo "enableMetrics = $enableMetrics"
echo "aggregatorNode = ${aggregatorNode:-<auto-select>}"
echo "coreDumps = ${coreDumps:-disabled}"
echo "checkpointSyncUrl = ${checkpointSyncUrl:-<not set>}"
echo "restartClient = ${restartClient:-<not set>}"
echo "skipLeanpoint = ${skipLeanpoint:-false}"