2018-09-14 08:46:34 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
DIR="$(cd $(dirname "$0")/../../config/cli; pwd)"
|
|
|
|
|
|
|
|
echo "Downloading https://fleets.status.im/"
|
|
|
|
json=$(curl --silent https://fleets.status.im/)
|
2020-01-08 12:19:09 +00:00
|
|
|
fleets=(
|
|
|
|
'eth.prod'
|
|
|
|
'eth.beta'
|
|
|
|
'eth.staging'
|
|
|
|
'eth.test'
|
|
|
|
)
|
|
|
|
|
2018-09-14 08:46:34 +00:00
|
|
|
for fleet in ${fleets[@]}; do
|
|
|
|
echo "Processing $fleet fleet..."
|
|
|
|
fleetJSON=$(echo $json | jq ".fleets.\"$fleet\"")
|
|
|
|
boot=$(echo $fleetJSON | jq ".boot | map(.)" -r)
|
|
|
|
mail=$(echo $fleetJSON | jq ".mail | map(.)" -r)
|
2018-09-19 15:08:54 +00:00
|
|
|
|
|
|
|
# Get random nodes from whisper node list
|
|
|
|
maxStaticNodeCount=2
|
|
|
|
staticNodeCount=$(echo $fleetJSON | jq ".whisper | length")
|
|
|
|
index=$(($RANDOM % ($staticNodeCount - ($maxStaticNodeCount - 1))))
|
|
|
|
whisper=$(echo $fleetJSON | jq ".whisper | map(.) | .[$index:($index + $maxStaticNodeCount)]" -r)
|
|
|
|
|
2018-09-14 08:46:34 +00:00
|
|
|
git checkout $DIR/fleet-$fleet.json \
|
|
|
|
&& jq ".ClusterConfig.BootNodes = $boot | .ClusterConfig.TrustedMailServers = $mail | .ClusterConfig.StaticNodes = $whisper" $DIR/fleet-$fleet.json \
|
|
|
|
| tee "$DIR/tmp.json" >/dev/null \
|
|
|
|
&& mv $DIR/tmp.json $DIR/fleet-$fleet.json
|
|
|
|
done
|