#!/usr/bin/env bash
# Run the admin server — MUST use same DB as main canteen-asset-tracker
set -euo pipefail

PORT="${PORT:-8090}"
HOST="${HOST:-0.0.0.0}"
APP_DIR="$(cd "$(dirname "$0")" && pwd)"
CANTEEN_DB_PATH="${CANTEEN_DB_PATH:-${APP_DIR}/../canteen-asset-tracker/assets.db}"

export CANTEEN_DB_PATH

exec python -m uvicorn admin_server:app \
  --host "$HOST" \
  --port "$PORT" \
  --reload \
  --log-level info
