This commit is contained in:
squidbear
2025-04-01 07:12:05 +02:00
parent 6283e3fa1a
commit 42a8ed5761

View File

@@ -93,7 +93,14 @@ for part in "${parts[@]}"; do
[ -f "$input_file" ] || input_file="$BASEPATH/default.cfg" [ -f "$input_file" ] || input_file="$BASEPATH/default.cfg"
# Run envsubst to replace environment variables in the input file and save the result to the output file # Run envsubst to replace environment variables in the input file and save the result to the output file
upstreams+=("$(envsubst < "$input_file")") if yq e '.upstreams' $part >/dev/null 2>&1; then
echo "upstreams key exists"
upstreams+=("$(yq e '.upstreams' $part | sed 's/^/ /' | envsubst)")
else
upstreams+=("$(envsubst < "$input_file")")
echo "upstreams key does not exist"
fi
break break
fi fi
done done
@@ -136,14 +143,10 @@ while IFS= read -r url; do
[ -f "$input_file" ] || input_file="$BASEPATH/default.cfg" [ -f "$input_file" ] || input_file="$BASEPATH/default.cfg"
# Run envsubst to replace environment variables in the input file and save the result to the output file # Run envsubst to replace environment variables in the input file and save the result to the output file
if yq e '.upstreams' tron-mainnet.yml >/dev/null 2>&1; then upstreams+=("$(envsubst < "$input_file")")
echo "upstreams key exists"
upstreams+=(yq e '.upstreams' tron-mainnet.yml | sed 's/^/ /' | envsubst)
else
upstreams+=("$(envsubst < "$input_file")")
echo "upstreams key does not exist"
fi
done < $BASEPATH/external-rpcs.txt done < $BASEPATH/external-rpcs.txt
fi fi