#!/bin/sh

export HOSTNAME=0.0.0.0
export PORT=3000

echo "=== SpomeniQR Starting ==="
echo "DATABASE_URL: ${DATABASE_URL:+set}"
echo "CLERK_SECRET_KEY: ${CLERK_SECRET_KEY:+set}"
echo "S3_ENDPOINT: ${S3_ENDPOINT:+set}"

echo "Running Prisma migrations..."
npx prisma migrate deploy || {
  echo "WARNING: Prisma migrations failed, continuing anyway..."
}

echo "Starting Next.js server on 0.0.0.0:3000..."
exec node server.js