Skip to content

Commit

Permalink
Fix output format
Browse files Browse the repository at this point in the history
mcrouter is *REALLY* annoying when it comes to servers list ffs
  • Loading branch information
Tristan971 committed Nov 22, 2024
1 parent 89aab02 commit 158905b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/watch-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SCRIPTDIR="$(dirname "$0")"
source "$SCRIPTDIR/lib.sh"

CONFIG_TEMPLATE="${1:-${CONFIG_TEMPLATE:-"/config/config.tpl.json"}}"
CONFIG_OUTPUT="${CONFIG_OUTPUT:-"/config/config.json"}"
CONFIG_OUTPUT="${2:-${CONFIG_OUTPUT:-"/config/config.json"}}"
WATCH_INTERVAL_SECONDS="${WATCH_INTERVAL_SECONDS:-5}"

echo "----------------------------------"
Expand Down Expand Up @@ -65,8 +65,9 @@ while true; do
else
echo " < $(jq -c . "$cluster_file")"
pools_with_cluster=$(jq -r ".pools | to_entries[] | select(.value.servers == [ \"dnssrv:$cluster_dnssrv\" ]) | .key" "$conf_epoch_file")
cluster_ipports_array=$(jq -c '[.[] | (.ip + ":" + (.port|tostring))]' "$cluster_file")
for pool in $pools_with_cluster; do
if ! jq_i ".pools.$pool = $(cat "$cluster_file")" "$conf_epoch_file"; then
if ! jq_i ".pools.$pool = $cluster_ipports_array" "$conf_epoch_file"; then
successful_lookups="false"
fi
done
Expand Down

0 comments on commit 158905b

Please sign in to comment.