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:
@@ -1,3 +1,4 @@
|
||||
import { getDebugLog } from "../../utils/configUtils";
|
||||
// /services/webservice/fetchGisLinesStatusService.js
|
||||
let __configCache;
|
||||
async function getConfig() {
|
||||
@@ -16,7 +17,7 @@ export const fetchGisLinesStatusService = async () => {
|
||||
if (useMocks) {
|
||||
const mockBasePath = "/api/mocks/webservice/gisLinesStatus";
|
||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisLinesStatusService ", mockURL);
|
||||
}
|
||||
|
||||
@@ -37,7 +38,7 @@ export const fetchGisLinesStatusService = async () => {
|
||||
const idMap = params.get("m");
|
||||
|
||||
const url = `${baseUrl}/GisLinesStatus?idMap=${idMap}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("📡 fetchGisLinesStatusService URL:", url);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { getDebugLog } from "../../utils/configUtils";
|
||||
let __configCache;
|
||||
async function getConfig() {
|
||||
if (__configCache) return __configCache;
|
||||
@@ -15,7 +16,7 @@ export const fetchGisStationsMeasurementsService = async () => {
|
||||
if (useMocks) {
|
||||
const mockBasePath = "/api/mocks/webservice/gisStationsMeasurements";
|
||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsMeasurementsService ", mockURL);
|
||||
}
|
||||
|
||||
@@ -38,7 +39,7 @@ export const fetchGisStationsMeasurementsService = async () => {
|
||||
const idUser = params.get("u");
|
||||
|
||||
const url = `${baseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("📡 fetchGisStationsMeasurementsService URL:", url);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,8 @@
|
||||
* @returns {Promise<Array>} Liste mit Points[]
|
||||
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
|
||||
*/
|
||||
let __configCache;
|
||||
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;
|
||||
}
|
||||
|
||||
import { getDebugLog, getConfig } from "../../utils/configUtils";
|
||||
|
||||
export const fetchGisStationsStaticDistrictService = async () => {
|
||||
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
||||
@@ -22,7 +16,7 @@ export const fetchGisStationsStaticDistrictService = async () => {
|
||||
if (useMocks) {
|
||||
const mockBasePath = "/api/mocks/webservice/gisStationsStaticDistrict";
|
||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStaticDistrictService ", mockURL);
|
||||
}
|
||||
|
||||
@@ -45,7 +39,7 @@ export const fetchGisStationsStaticDistrictService = async () => {
|
||||
const idUser = params.get("u");
|
||||
|
||||
const url = `${baseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("📡 fetchGisStationsStaticDistrictService URL:", url);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,8 @@
|
||||
* @returns {Promise<Array>} Liste mit Statis[]
|
||||
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
|
||||
*/
|
||||
let __configCache;
|
||||
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;
|
||||
}
|
||||
|
||||
import { getDebugLog, getConfig } from "../../utils/configUtils";
|
||||
|
||||
export const fetchGisStationsStatusDistrictService = async () => {
|
||||
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
||||
@@ -22,7 +16,7 @@ export const fetchGisStationsStatusDistrictService = async () => {
|
||||
if (useMocks) {
|
||||
const mockBasePath = "/api/mocks/webservice/gisStationsStatusDistrict";
|
||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStatusDistrictService ", mockURL);
|
||||
}
|
||||
|
||||
@@ -45,7 +39,7 @@ export const fetchGisStationsStatusDistrictService = async () => {
|
||||
const idUser = params.get("u");
|
||||
|
||||
const url = `${baseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("📡 fetchGisStationsStatusDistrictService URL:", url);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,8 @@
|
||||
* @returns {Promise<Array>} Liste mit Systems[]
|
||||
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
|
||||
*/
|
||||
let __configCache;
|
||||
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;
|
||||
}
|
||||
|
||||
import { getDebugLog, getConfig } from "../../utils/configUtils";
|
||||
|
||||
export const fetchGisSystemStaticService = async () => {
|
||||
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
||||
@@ -21,7 +15,7 @@ export const fetchGisSystemStaticService = async () => {
|
||||
if (useMocks) {
|
||||
const mockBasePath = "/api/mocks/webservice/gisSystemStatic";
|
||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchGisSystemStaticService ", mockURL);
|
||||
}
|
||||
|
||||
@@ -44,7 +38,7 @@ export const fetchGisSystemStaticService = async () => {
|
||||
const idUser = params.get("u");
|
||||
|
||||
const url = `${baseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("📡 fetchGisSystemStaticService von service URL:", url);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,8 @@
|
||||
* @returns {Promise<Array>} Rechte-Array
|
||||
* @throws {Error} bei Lade- oder Strukturfehler
|
||||
*/
|
||||
let __configCache;
|
||||
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;
|
||||
}
|
||||
|
||||
import { getDebugLog, getConfig } from "../../utils/configUtils";
|
||||
|
||||
export const fetchUserRightsService = async () => {
|
||||
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
||||
@@ -21,7 +15,7 @@ export const fetchUserRightsService = async () => {
|
||||
if (useMocks) {
|
||||
const mockBasePath = "/api/mocks/webservice/gisSystemStatic";
|
||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("🧪 Mock-Modus aktiviert: fetchUserRightsService ", mockURL);
|
||||
}
|
||||
|
||||
@@ -40,7 +34,7 @@ export const fetchUserRightsService = async () => {
|
||||
const idUser = params.get("u");
|
||||
|
||||
const url = `${baseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("🔍 Rechte-Fetch URL:", url);
|
||||
}
|
||||
|
||||
@@ -56,7 +50,7 @@ export const fetchUserRightsService = async () => {
|
||||
}
|
||||
|
||||
const json = await response.json();
|
||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||
if (getDebugLog()) {
|
||||
console.log("👤 Rechte-Response JSON:", json);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user