Files
ethereum-rpc-docker/network-to-config.sh
Sebastian 7f9d5200ef initial
2024-09-24 07:26:48 +02:00

16 lines
426 B
Bash
Executable File

#!/bin/bash
# Check if JSON file is provided
if [ -z "$1" ]; then
echo "Usage: $0 <key1> [key2 ...]"
exit 1
fi
BASEPATH="$(dirname "$0")"
JSON_FILE="$BASEPATH/reference-rpc-endpoint.json"
shift
# Extract values under 'default' or 'archive' attributes for given keys
jq --argfile input "$JSON_FILE" '. as $in | ($IN.input | select(has("default")) | .default[]) + ($IN.input | select(has("archive")) | .archive[])' "$@"