#!/bin/sh
set -e

cat > /app/dist/config.js <<EOF
window.__APP_CONFIG__ = {
  apiUrl:  '${VITE_API_URL:-http://localhost:8099}',
  authUrl: '${VITE_AUTH_URL:-http://localhost:8082}'
};
EOF

echo "Generated config.js — apiUrl: ${VITE_API_URL}"

exec "$@"
