#!/usr/bin/bash
set -e

uv run python manage.py await_services

if [ "${DEBUG:-0}" = "1" ]; then
  uv run uvicorn --host 0.0.0.0 --port 8000 --reload --log-level debug --ws-ping-interval 20 --ws-ping-timeout 20 evibes.asgi:application
else
  UVICORN_WORKERS=${UVICORN_WORKERS:-4}
  uv run uvicorn --host 0.0.0.0 --port 8000 --workers "$UVICORN_WORKERS" --proxy-headers --forwarded-allow-ips='*' --ws-ping-interval 20 --ws-ping-timeout 20 evibes.asgi:application
fi
