Enhance backend configuration and error handling: Update CORS settings to allow dynamic origins, improve RabbitMQ connection handling in chat services, and adjust API server host configuration. Refactor environment variables for better flexibility and add fallback mechanisms for WebSocket and chat services. Update frontend environment files for consistent API and WebSocket URLs.
This commit is contained in:
@@ -1,20 +1,10 @@
|
||||
import axios from 'axios';
|
||||
import store from '../store';
|
||||
import { getApiBaseUrl } from './appConfig.js';
|
||||
|
||||
// API-Basis-URL - Apache-Proxy für Produktion, direkte Verbindung für lokale Entwicklung
|
||||
const getApiBaseURL = () => {
|
||||
// Wenn explizite Umgebungsvariable gesetzt ist, diese verwenden
|
||||
if (import.meta.env.VITE_API_BASE_URL) {
|
||||
return import.meta.env.VITE_API_BASE_URL;
|
||||
}
|
||||
|
||||
// Für lokale Entwicklung: direkte Backend-Verbindung
|
||||
if (import.meta.env.DEV || window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
|
||||
return 'http://localhost:3001';
|
||||
}
|
||||
|
||||
// Für Produktion: Root-Pfad, da API-Endpunkte bereits mit /api beginnen
|
||||
return '';
|
||||
return getApiBaseUrl();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user