feat: add environment configuration files and update API base URL handling for production

This commit is contained in:
JSC
2025-08-09 14:43:09 +02:00
parent b43d29e862
commit d53c08d7a0
10 changed files with 55 additions and 8 deletions

View File

@@ -27,7 +27,12 @@ export function SocketProvider({ children }: SocketProviderProps) {
const createSocket = useCallback(() => {
if (!user) return null
const newSocket = io('http://localhost:8000', {
// Get socket URL - use relative URL in production with reverse proxy
const socketUrl = import.meta.env.PROD
? '' // Use relative URL in production (same origin as frontend)
: (import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000')
const newSocket = io(socketUrl, {
withCredentials: true,
transports: ['polling', 'websocket'],
timeout: 20000,