/** * RunwayModeler Frontend Configuration * * This file configures the frontend for different environments. * In production, replace the API_URL with your Cloud Run service URL. * * Usage: * 1. For Cloud Storage hosting with Cloud Run backend: * Set RUNWAYMODELER_API_URL to your Cloud Run service URL * * 2. For nginx/Load Balancer proxy setup: * Leave RUNWAYMODELER_API_URL undefined (will use /api prefix) * * 3. For local development: * Leave RUNWAYMODELER_API_URL undefined (will use localhost:8000) */ (function() { // Production API URL - Set this to your Cloud Run service URL // For custom domain with load balancer, use empty string for relative URLs // For direct Cloud Run access, use the full URL const hostname = window.location.hostname; if (hostname === 'runwaymodeler.net' || hostname === 'www.runwaymodeler.net' || hostname === 'runwaymodeler.com' || hostname === 'www.runwaymodeler.com') { // Custom domain - use relative URLs (load balancer routes to Cloud Run) window.RUNWAYMODELER_API_URL = ''; } else if (hostname === 'localhost' || hostname === '127.0.0.1') { // Local development window.RUNWAYMODELER_API_URL = 'http://localhost:8000'; } else { // Cloud Storage direct access - use Cloud Run URL window.RUNWAYMODELER_API_URL = 'https://runwaymodeler-api-575579006666.us-central1.run.app'; } // Alternative: Detect environment and set automatically // Uncomment and modify as needed: /* const hostname = window.location.hostname; if (hostname === 'runwaymodeler.com' || hostname === 'www.runwaymodeler.com') { // Production window.RUNWAYMODELER_API_URL = 'https://api.runwaymodeler.com'; } else if (hostname.endsWith('.web.app') || hostname.endsWith('.firebaseapp.com')) { // Firebase hosting window.RUNWAYMODELER_API_URL = 'https://runwaymodeler-api-xxxxxxxxxx-uc.a.run.app'; } else if (hostname.endsWith('.storage.googleapis.com')) { // Cloud Storage hosting window.RUNWAYMODELER_API_URL = 'https://runwaymodeler-api-xxxxxxxxxx-uc.a.run.app'; } // Local development will use http://localhost:8000 automatically */ // Feature flags (optional) window.RUNWAYMODELER_CONFIG = { // Enable debug logging debug: window.location.hostname === 'localhost', // Stripe publishable key (for client-side Stripe.js if needed) stripePublishableKey: undefined, // Analytics (placeholder) analyticsEnabled: window.location.hostname !== 'localhost' }; // Log configuration in debug mode if (window.RUNWAYMODELER_CONFIG.debug) { console.log('RunwayModeler Config:', { apiUrl: window.RUNWAYMODELER_API_URL || 'auto-detect', config: window.RUNWAYMODELER_CONFIG }); } })();