#!/bin/sh
# Container start-up: migrate, optionally load the demo data, then serve.
# SEED_DEMO_ON_START=true loads the demo sites, products and users the first time only (it does
# nothing if they already exist), which is how a host without a shell (Render free) gets its data.
set -e
alembic upgrade head
if [ "${SEED_DEMO_ON_START:-false}" = "true" ]; then
  python -m app.modules.demo.seed
fi
exec uvicorn app.main:app --host 0.0.0.0 --port "${PORT:-8000}" --proxy-headers --forwarded-allow-ips='*'
