From 4e7f1ce6ca7d6082e02b50805009836c86deae7c Mon Sep 17 00:00:00 2001 From: squidbear <379651+czarly@users.noreply.github.com> Date: Tue, 1 Apr 2025 07:28:18 +0200 Subject: [PATCH] fix --- upstreams.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/upstreams.sh b/upstreams.sh index 80d0a2b8..fea0ba06 100755 --- a/upstreams.sh +++ b/upstreams.sh @@ -92,12 +92,13 @@ for part in "${parts[@]}"; do [ -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 - if yq e '.upstreams' "$BASEPATH/$part" >/dev/null 2>&1; then - echo "upstreams key exists for $part" - upstreams+=("$(yq e '.upstreams' $BASEPATH/$part | sed 's/^/ /' | envsubst)") + # Run envsubst to replace environment variables in the input file and save the result to the output file + if yaml2json < tron-mainnet.yml | jq -e '.upstreams' >/dev/null 2>&1; then + echo "upstreams key exists in $part" + upstreams+=($(yaml2json < tron-mainnet.yml | jq '.upstreams' | sed 's/^/ /' | envsubst | json2yaml)) else - upstreams+=("$(envsubst < "$input_file")") + echo "upstreams config $input_file for $part" + upstreams+=("$(envsubst < "$input_file")") fi break