#!/bin/bash
# Start koopa-nym via compose (prefers ~/koopa-nym on live host)
set -euo pipefail
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
if [ -d "${HOME}/koopa-nym" ] && [ -f "${HOME}/koopa-nym/compose.yml" ]; then
  DIR="${HOME}/koopa-nym"
else
  DIR="${NYM_SRC:-$ROOT/configs/nym}"
fi
cd "$DIR"
if [ ! -f .env ] && [ -f .env.example ]; then
  echo "note: no .env — copy .env.example and set NYMNODE_PUBLIC_IPS" >&2
fi
if command -v podman-compose >/dev/null 2>&1; then
  podman-compose up -d --build
elif podman compose version >/dev/null 2>&1; then
  podman compose up -d --build
else
  echo "need podman compose or podman-compose" >&2
  exit 1
fi
podman ps --filter name=koopa-nym
