update entrypoint

This commit is contained in:
2026-01-15 16:35:42 +02:00
parent ea4990457e
commit 48870802ca

View File

@@ -8,15 +8,29 @@ echo "🚀 Starting application... $(date '+%Y-%m-%d %H:%M:%S')"
# Validate critical environment variables at runtime
if [ "$NODE_ENV" = "production" ]; then
echo "🔍 Validating production environment... $(date '+%Y-%m-%d %H:%M:%S')"
# Required vars (expand as needed)
required_vars="DATABASE_URL SESSION_SECRET ADMIN_PASSWORD CSRF_SECRET SUPABASE_SERVICE_ROLE_KEY"
for var in $required_vars; do
if [ -z "${!var}" ]; then
echo "❌ ERROR: $var is required in production $(date '+%Y-%m-%d %H:%M:%S')"
exit 1
fi
done
# Check each variable individually for better portability
if [ -z "$DATABASE_URL" ]; then
echo "❌ ERROR: DATABASE_URL is required in production $(date '+%Y-%m-%d %H:%M:%S')"
exit 1
fi
if [ -z "$SESSION_SECRET" ]; then
echo "❌ ERROR: SESSION_SECRET is required in production $(date '+%Y-%m-%d %H:%M:%S')"
exit 1
fi
if [ -z "$ADMIN_PASSWORD" ]; then
echo "❌ ERROR: ADMIN_PASSWORD is required in production $(date '+%Y-%m-%d %H:%M:%S')"
exit 1
fi
if [ -z "$CSRF_SECRET" ]; then
echo "❌ ERROR: CSRF_SECRET is required in production $(date '+%Y-%m-%d %H:%M:%S')"
exit 1
fi
if [ -z "$SUPABASE_SERVICE_ROLE_KEY" ]; then
echo "❌ ERROR: SUPABASE_SERVICE_ROLE_KEY is required in production $(date '+%Y-%m-%d %H:%M:%S')"
exit 1
fi
# Optional: Check URL formats (basic regex)
if ! echo "$DATABASE_URL" | grep -qE '^postgres(ql)?://'; then
@@ -49,4 +63,14 @@ fi
# Start the application
echo "🎯 Starting Next.js server... $(date '+%Y-%m-%d %H:%M:%S')"
exec node server.js
# Check if server.js exists (Next.js standalone output)
if [ -f "server.js" ]; then
echo "✅ Found server.js, starting with standalone build... $(date '+%Y-%m-%d %H:%M:%S')"
exec node server.js
else
echo "❌ ERROR: server.js not found. This might indicate a build issue. $(date '+%Y-%m-%d %H:%M:%S')"
echo "Contents of /app directory:"
ls -la
exit 1
fi