// API configuration with environment support export const getApiBase = () => { // In Docker development environment, use the environment variable if available if (import.meta.env.VITE_API_URL) { console.log("Using VITE_API_URL:", import.meta.env.VITE_API_URL); return import.meta.env.VITE_API_URL; } // Check if we're in a Docker environment by looking at hostname if ( typeof window !== "undefined" && window.location.hostname !== "localhost" && window.location.hostname !== "127.0.0.1" ) { const dockerApiUrl = `http://${window.location.hostname}:5280/api`; console.log("Using Docker API URL:", dockerApiUrl); // If accessing via Docker host IP, try to use the backend port directly return dockerApiUrl; } // Default to proxy for local development console.log("Using proxy API URL: /api"); return "/api"; }; export const API_BASE = getApiBase();