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

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
APP_DIR="$ROOT_DIR/apps/backend-hub"
VENV_DIR="$APP_DIR/.venv"

if [ ! -d "$VENV_DIR" ]; then
  python3 -m venv "$VENV_DIR"
fi

source "$VENV_DIR/bin/activate"
pip install -r "$APP_DIR/requirements.txt"

export PYTHONPATH="$APP_DIR"

uvicorn app.main:app --reload --host 0.0.0.0 --port "${BACKEND_HUB_PORT:-8101}"
