Skip to content

Commit

Permalink
get rpc urls from .env
Browse files Browse the repository at this point in the history
  • Loading branch information
mmd-afegbua committed Feb 21, 2024
1 parent 1276d2d commit c62fe37
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions scripts/manageSnapshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
set -xe

#Variables
filename="networks"
if [ -f .env ]; then
source .env
else
echo "Error: .env file not found. Please create a .env file with the required environment variables." >&2
exit 1
fi

rpc_urls="${SNAPSHOT_RPC_URLS}"
ipfs_api="${IPFS_API}"

generate_snapshot() {
Expand All @@ -14,13 +21,17 @@ generate_snapshot() {
mkdir snapshots
fi

while IFS=, read -r _ rpc; do
echo "${rpc} - ${rpc:-no rpc found}"
[ -n "$rpc" ] && node ./scripts/buildSnapshot.js "$rpc"
done < "$filename"
# Get list of RPC URLs from environment variable
IFS=',' read -r -a rpc_array <<< "$rpc_urls"
for rpc in "${rpc_array[@]}"; do
echo "${rpc}"
[ -n "$rpc" ] && node ./scripts/buildSnapshot.js "https://$rpc"
done

echo "Generating done"
}


upload_snapshot() {
echo "Uploading snapshots..."
ipfs_logfile="logs/ipfs_$(date '+%Y-%m-%d').txt"
Expand Down

0 comments on commit c62fe37

Please sign in to comment.