#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "$0")"
PORTA="${PORT:-}"
if [[ -z "$PORTA" && -f .env ]]; then PORTA="$(grep -E '^PORT=' .env | tail -1 | cut -d= -f2-)"; fi
PORTA="${PORTA:-8899}"
node -e "fetch('http://127.0.0.1:${PORTA}/saude').then(async r=>{console.log(r.status, await r.text());process.exit(r.ok?0:1)}).catch(e=>{console.error(e.message);process.exit(1)})"
