-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathparse-env.sh
More file actions
executable file
·195 lines (185 loc) · 4.59 KB
/
parse-env.sh
File metadata and controls
executable file
·195 lines (185 loc) · 4.59 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/bash
# set -e
if [ -n "$NETWORK_DIR" ]
then
# Support both absolute paths and relative paths (relative to scriptDir)
if [[ "$NETWORK_DIR" = /* ]]; then
_resolved_network_dir="$NETWORK_DIR"
else
_resolved_network_dir="$scriptDir/$NETWORK_DIR"
fi
echo "setting up network from $_resolved_network_dir"
configDir="$_resolved_network_dir/genesis"
dataDir="$_resolved_network_dir/data"
else
echo "set NETWORK_DIR env variable to run"
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
;;
--skip-nemo)
skipNemo=true
shift
;;
--prepare)
prepareMode=true
shift
;;
--subnets)
subnets="$2"
shift # past argument
shift # past value
;;
--dry-run)
dryRun=true
shift
;;
--replace-with)
replaceWith="$2"
shift
shift
;;
--network)
networkName="$2"
shift # past argument
shift # past value
;;
--logs)
enableLogs=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;
# Check genesis dir exists and is non-empty, unless --generateGenesis will create it
if [ "$generateGenesis" != "true" ] && [ ! -n "$(ls -A $configDir 2>/dev/null)" ]
then
echo "no genesis config at path=$configDir, exiting."
exit
fi;
# Validate --replace-with requires --restart-client
if [[ -n "$replaceWith" ]] && [[ ! -n "$restartClient" ]]; then
echo "Warning: --replace-with requires --restart-client. Ignoring --replace-with."
replaceWith=""
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
networkName="${networkName:-devnet-3}"
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}"
echo "skipNemo = ${skipNemo:-false}"
echo "dryRun = ${dryRun:-false}"
echo "replaceWith = ${replaceWith:-<not set>}"
echo "networkName = $networkName"
echo "enableLogs = ${enableLogs:-false}"