feat: Umgebungsspezifisches Laden von Datenquellen implementiert

- Alle fetch-Services (TDM, TDR, analoge/digitale Eingänge/Ausgänge, SystemSettings usw.) angepasst,
  um `NEXT_PUBLIC_NODE_ENV` zu verwenden.
- Entwicklungsumgebung lädt Daten aus /CPLmockData/...
- Produktionsumgebung verwendet echte Endpunkte mit /CPL?/CPL/...
- .env.production und .env.development korrekt berücksichtigt
- loadWindowVariables, WindowVariablesInitializer und verwandte Dateien bereinigt
- Mockdaten erscheinen nicht mehr versehentlich in Produktionsumgebung
This commit is contained in:
ISA
2025-03-27 11:03:23 +01:00
parent 0bec3fb148
commit c55f0e7fe5
21 changed files with 170 additions and 104 deletions

View File

@@ -3,12 +3,12 @@
export const fetchAllTDMDataFromServer = async (): Promise<any[]> => {
if (typeof window === "undefined") return [];
const isDev = window.location.hostname === "localhost";
const isDev = process.env.NEXT_PUBLIC_NODE_ENV === "development";
const slotRequests = Array.from({ length: 32 }, (_, i) => {
const url = isDev
? `/CPLmockData/TDM/slot${i}.json` // ✅ korrekt für DEV (Dateien im public-Ordner)
: `${window.location.origin}/CPL?Service/empty.acp&TDM=${i}`; // ✅ korrekt für PROD
? `/CPLmockData/TDM/slot${i}.json` // ✅ Entwicklung: aus public-Ordner
: `${window.location.origin}/CPL?Service/empty.acp&TDM=${i}`; // ✅ Produktion
return fetch(url)
.then((res) => (res.ok ? res.json() : null))