Skip to content

Commit

Permalink
Update renew-config.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyfilyanin authored Jul 19, 2024
1 parent e9c7d74 commit 32d7d80
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/renew-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ testnet_meta_url="https://github.com/gear-tech/gear/releases/download/v"$tag"/te
production_meta_url="https://github.com/gear-tech/gear/releases/download/v"$tag"/production_vara_runtime_v"$version"_metadata.scale"

echo "Downloading testnet metadata from $testnet_meta_url"
testnet_metadata=$(curl -L $testnet_meta_url)
curl -L $testnet_meta_url -o testnet_metadata.scale
if [ $? -ne 0 ]; then
echo "Failed to download testnet metadata"
exit 1
fi

echo "Downloading production metadata from $production_meta_url"
production_metadata=$(curl -L $production_meta_url)
curl -L $production_meta_url -o production_metadata.scale
if [ $? -ne 0 ]; then
echo "Failed to download production metadata"
exit 1
fi

echo "Updating testnet config"
jq --arg metadata "$testnet_metadata" --argjson version "$version" \
jq --argfile metadata testnet_metadata.scale --argjson version "$version" \
'.metadataRpc = $metadata | .specVersion = $version' \
"$TESTNET_CONFIG_PATH" > tmp.$$.json \
&& mv tmp.$$.json "$TESTNET_CONFIG_PATH"
Expand All @@ -35,10 +35,14 @@ if [ $? -ne 0 ]; then
fi

echo "Updating mainnet config"
jq --arg metadata "$production_metadata" --argjson version "$version" \
jq --argfile metadata production_metadata.scale --argjson version "$version" \
'.metadataRpc = $metadata | .specVersion = $version' \
"$MAINNET_CONFIG_PATH" > tmp.$$.json \
&& mv tmp.$$.json "$MAINNET_CONFIG_PATH"

if [ $? -ne 0 ]; then
echo "Failed to update mainnet config
echo "Failed to update mainnet config"
exit 1
fi

echo "Configuration update completed successfully"

0 comments on commit 32d7d80

Please sign in to comment.