useful script

This commit is contained in:
Sebastian
2024-09-08 13:14:10 +02:00
parent d3526dbac9
commit 8a55588c21

35
show-networks.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
BASEPATH="$(dirname "$0")"
source $BASEPATH/.env
IFS=':' read -ra parts <<< $COMPOSE_FILE
blacklist=("drpc.yml" "drpc-free.yml" "base.yml" "rpc.yml" "monitoring.yml" "ftp.yml" "backup-http.yml")
for part in "${parts[@]}"; do
include=true
for word in "${blacklist[@]}"; do
if echo "$part" | grep -qE "$word"; then
#echo "The path $path contains a blacklisted word: $word"
include=false
fi
done
if $include; then
default=$(jq -r "to_entries[] | select(.value.default[]? == \"${part%.yml}\") | .key" $BASEPATH/reference-rpc-endpoint.json)
archive=$(jq -r "to_entries[] | select(.value.archive[]? == \"${part%.yml}\") | .key" $BASEPATH/reference-rpc-endpoint.json)
if [ -n "$archive" ]; then
echo "${archive}_archive"
elif [ -n "$default" ]; then
echo "${default}_default"
else
exit 1
fi
fi
done