#!/bin/sh
set -e

echo "🔍 Waiting for PostgreSQL at $DB_HOST:$DB_PORT..."
until nc -z "$DB_HOST" "$DB_PORT"; do
  echo "⏳ PostgreSQL is not ready yet..."
  sleep 2
done
echo "✅ PostgreSQL is ready!"

echo "🏁 Starting LTI API (with Air hot reload)..."
exec air -c .air.toml