#!/usr/bin/env bash
# English comments only
set -euo pipefail
URL="${HM_READY_URL:-http://127.0.0.1:8100/health/ready}"
for i in {1..60}; do
  if curl -fsS "$URL" >/dev/null; then
    echo "[wait-hm] ready"
    exit 0
  fi
  sleep 2
done
echo "[wait-hm] timeout waiting for $URL" >&2
exit 1
