Bash command to detect PostgreSQL synchronous standby by Patroni API and jq
/usr/pgsql-16/bin/pg_isready -q && \
test "$(hostname -I | xargs):5432" == "$(curl -s localhost:8008/cluster | jq -Mcr '.members[] | select (.role == "sync_standby") | .host + ":" + (.port|tostring)')"