Debug-Logging zentralisiert: Nutzung von process.env.NEXT_PUBLIC_DEBUG_LOG entfernt und auf getDebugLog() mit config.json umgestellt

- Alle Vorkommen von process.env.NEXT_PUBLIC_DEBUG_LOG entfernt
- Debug-Konfiguration erfolgt jetzt ausschließlich über public/config.json
- getDebugLog()-Utility überall verwendet
- .env-Dateien werden für Debug-Logging nicht mehr benötigt
- Alle betroffenen Komponenten, Services und API
This commit is contained in:
ISA
2025-08-22 11:10:40 +02:00
parent a013c07394
commit 3896381a8f
27 changed files with 94 additions and 84 deletions

26
utils/configUtils.js Normal file
View File

@@ -0,0 +1,26 @@
// utils/configUtils.js
let __configCache;
export async function getConfig() {
if (__configCache) return __configCache;
const res = await fetch("/config.json");
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
__configCache = await res.json();
return __configCache;
}
// Sync helper for debugLog (for use in event handlers etc.)
let debugLogValue;
export function getDebugLog() {
if (debugLogValue !== undefined) return debugLogValue;
// Try to read from window.__appConfig if available (set at app start)
if (
typeof window !== "undefined" &&
window.__appConfig &&
typeof window.__appConfig.debugLog !== "undefined"
) {
debugLogValue = !!window.__appConfig.debugLog;
return debugLogValue;
}
// Fallback: default false
return false;
}