feat(backend/frontend): Aktualisierung der Abhängigkeiten und Verbesserung der Umgebungsvariablen
- Hinzufügen neuer Abhängigkeiten in der package-lock.json, einschließlich @types/trusted-types und call-bind-apply-helpers. - Aktualisierung der Versionen mehrerer Pakete, darunter brace-expansion, dompurify, express und express-session. - Anpassung der API-Basis-URL in axios.js zur Unterstützung verschiedener Umgebungen. - Verbesserung der WebSocket-URL-Konfiguration in chatWs.js für Produktionsumgebungen. - Aktualisierung der Chat-Konfiguration in chatConfig.js zur Unterstützung von sicheren WebSocket-Verbindungen.
This commit is contained in:
@@ -1,8 +1,28 @@
|
||||
import axios from 'axios';
|
||||
import store from '../store';
|
||||
|
||||
// API-Basis-URL basierend auf der Umgebung
|
||||
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;
|
||||
}
|
||||
|
||||
// In Entwicklung: direkte Backend-Verbindung
|
||||
if (import.meta.env.DEV) {
|
||||
return 'http://localhost:3001';
|
||||
}
|
||||
|
||||
// In Produktion: über Apache-Proxy
|
||||
return '/api';
|
||||
};
|
||||
|
||||
// Debug-Informationen
|
||||
console.log('🌍 Environment:', import.meta.env.MODE);
|
||||
console.log('🔗 API Base URL:', getApiBaseURL());
|
||||
|
||||
const apiClient = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:3001',
|
||||
baseURL: getApiBaseURL(),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const env = import.meta.env || {};
|
||||
export const CHAT_WS_URL = env.VITE_CHAT_WS_URL
|
||||
|| (env.VITE_CHAT_WS_HOST || env.VITE_CHAT_WS_PORT
|
||||
? `ws://${env.VITE_CHAT_WS_HOST || 'localhost'}:${env.VITE_CHAT_WS_PORT || '1235'}`
|
||||
: `ws://localhost:1235`);
|
||||
: (typeof window !== 'undefined' && window.location.protocol === 'https:' ? 'wss://' : 'ws://') + window.location.host + '/socket.io/');
|
||||
|
||||
// Event/type keys
|
||||
export const CHAT_EVENT_KEY = env.VITE_CHAT_EVENT_KEY || 'type';
|
||||
|
||||
Reference in New Issue
Block a user