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

ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "${ROOT_DIR}"

export PORT="${PORT:-9415}"
export PYTHONUNBUFFERED=1

if [ -d "../sofiia-console/venv" ]; then
  # shellcheck disable=SC1091
  source ../sofiia-console/venv/bin/activate
elif [ -d "../../venv" ]; then
  # shellcheck disable=SC1091
  source ../../venv/bin/activate
fi

exec python3 -m uvicorn app.main:app --host 127.0.0.1 --port "${PORT}"
