Files
nodeMap/utils/configUtils.js
ISA 3896381a8f 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
2025-08-22 11:10:40 +02:00

27 lines
804 B
JavaScript

// 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;
}