#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "$ROOT/scripts/env.sh"

ADDR="${ADDR:-localhost:8080}"

if [[ ! -x "$ROOT/bin/goondex" ]]; then
  echo "Binary not found; building first..."
  "$ROOT/scripts/build.sh"
fi

echo "Starting Goondex web UI on http://$ADDR"
"$ROOT/bin/goondex" web --addr "$ADDR"
