#!/bin/sh
set -eu
BASE="${PINGCTL_BASE:-https://devtools-backend.com}"
if [ "${1:-}" = "probe" ]; then
  shift
fi
HOST="${1:-}"
if [ -z "$HOST" ]; then
  echo "usage: pingctl probe <host>" >&2
  exit 2
fi
exec curl -fsSL "$BASE/api/v1/ping?host=$HOST"
