# LinkForty Production Environment Configuration # # This file shows all environment variables needed for production deployment on Fly.io # # SECURITY WARNING: Never commit actual secrets to version control! # Use `fly secrets set` to configure these values securely. # # Example: # fly secrets set DATABASE_URL="postgresql://..." # fly secrets set REDIS_URL="rediss://..." # ============================================================================ # REQUIRED: Database Configuration # ============================================================================ # PostgreSQL connection string # Format: postgresql://username:password@host:port/database?sslmode=require # # For Fly Postgres (automatically set by `fly postgres attach`): # postgresql://user:pass@appname.internal:5432/dbname?sslmode=require # # For external providers (Supabase, Neon, AWS RDS): # Use connection string from provider dashboard # # IMPORTANT: Always include ?sslmode=require for production DATABASE_URL="postgresql://username:password@host:5432/linkforty?sslmode=require" # ============================================================================ # OPTIONAL BUT RECOMMENDED: Redis Cache # ============================================================================ # Redis connection string (TLS encrypted) # Format: rediss://default:password@host:6379 # # For Upstash Redis (via Fly.io): # Run: fly redis create # Use the REDIS_URL provided # # IMPORTANT: Use rediss:// (double 's') for TLS encryption in production # # If not set, LinkForty will work but without caching (slower, higher DB load) REDIS_URL="rediss://default:password@host:6379" # ============================================================================ # APPLICATION CONFIGURATION # ============================================================================ # Environment mode (should always be "production" for deployed apps) NODE_ENV="production" # Server port (default: 8080, must match fly.toml internal_port) PORT="8080" # ============================================================================ # CORS CONFIGURATION # ============================================================================ # Allowed origins for CORS (comma-separated for multiple origins) # # Single origin: # CORS_ORIGIN="https://yourdomain.com" # # Multiple origins: # CORS_ORIGIN="https://yourdomain.com,https://app.yourdomain.com,https://www.yourdomain.com" # # SECURITY WARNING: Never use "*" in production - only specific domains! CORS_ORIGIN="https://yourdomain.com" # ============================================================================ # OPTIONAL: Advanced Configuration # ============================================================================ # Log level (error, warn, info, debug) # Default: "info" # Use "error" or "warn" in production to reduce log volume LOG_LEVEL="info" # Request timeout in milliseconds # Default: 30000 (30 seconds) # REQUEST_TIMEOUT="30000" # Database connection pool settings # Default min: 2, max: 10 # Adjust based on your database plan and expected load # DB_POOL_MIN="2" # DB_POOL_MAX="10" # Redis cache TTL (time-to-live) in seconds # Default: 3600 (1 hour) # Higher values = less DB load, potentially stale data # Lower values = more accurate, higher DB load # REDIS_TTL="3600" # ============================================================================ # CUSTOM DOMAIN (Optional) # ============================================================================ # If using a custom domain for short links # Example: If your short links should be https://go.yourdomain.com/abc123 # Set this to match your domain configuration # # See: https://fly.io/docs/app-guides/custom-domains-with-fly/ # CUSTOM_DOMAIN="go.yourdomain.com" # ============================================================================ # MONITORING & OBSERVABILITY (Optional) # ============================================================================ # Sentry DSN for error tracking # Sign up at https://sentry.io and get your DSN # SENTRY_DSN="https://...@sentry.io/..." # New Relic license key # NEW_RELIC_LICENSE_KEY="..." # Datadog API key # DATADOG_API_KEY="..." # ============================================================================ # DEPLOYMENT CHECKLIST # ============================================================================ # # Before deploying to production, ensure: # # [ ] DATABASE_URL is set with sslmode=require # [ ] REDIS_URL is set (or intentionally omitted) # [ ] CORS_ORIGIN is set to your actual domain(s), NOT "*" # [ ] NODE_ENV is set to "production" # [ ] All secrets are set via `fly secrets set`, not in fly.toml # [ ] You've reviewed SECURITY.md checklist # [ ] Database migrations have been tested # [ ] Health check endpoint (/health) works # [ ] You have database backups configured # # Set secrets with: # fly secrets set DATABASE_URL="..." --app your-app # fly secrets set REDIS_URL="..." --app your-app # fly secrets set CORS_ORIGIN="..." --app your-app # # Verify secrets (values are hidden): # fly secrets list --app your-app # # ============================================================================