Files
nodeMap/docs/config/config.md
ISA 257341475c docs(config): Markdown-Dokumentation für zentrale Konfigurationsdateien erstellt
- Dokumentationen für:
  - appVersion.js → appVersion.md
  - layers.js → layers.md
  - paths.js → paths.md
  - urls.js → urls.md
- Übersicht in README.md mit internen Links ergänzt
- Erklärt dynamische URL-Logik, Layer-Setup und Basispfadstruktur
2025-05-27 15:20:07 +02:00

61 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- /docs/config/config.md -->
# ⚙️ config.js zentrale Konfiguration und Umgebungssteuerung
## Zweck
Diese Datei enthält zentrale Konfigurationswerte, die abhängig von der Umgebung
(Entwicklung oder Produktion) dynamisch erzeugt werden.
---
## Ersetzungen von Umgebungsvariablen
Vorher wurden folgende `.env.local` Variablen verwendet:
- `NEXT_PUBLIC_BASE_URL`
- `NEXT_PUBLIC_SERVER_URL`
Diese wurden ersetzt durch dynamische Berechnung anhand von:
```env
NEXT_PUBLIC_API_PORT_MODE=dev
```
---
## Dynamische Berechnung von `serverURL`
Die Konfiguration entscheidet anhand des Modus:
```js
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
const serverURL = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80` : `${window.location.origin}`;
```
→ Dadurch funktioniert der Code ohne Anpassung bei IP-/Server-Wechseln oder Portunterschieden.
---
## Konfigurationswerte
- `USE_MOCK_API`: aktiviert lokale Mock-Daten
- `serverURL`: Basis für Webservice-Aufrufe (`/talas5/...`)
- `mapGisStationsStaticDistrictUrl`: komplette zusammengesetzte URL
- `useMockStationData`: true/false aus `.env.local`
---
## Vorteile
| Punkt | Vorteil |
| ------------------------------- | ---------------------------------------- |
| Keine festen IPs oder Ports | ✅ Weniger Fehler, einfacher Umzug |
| Einheitlich mit anderen Dateien | ✅ Gleiche Struktur wie Webservice-Setup |
| Lesbar & leicht anpassbar | ✅ Auch ohne Doku sofort verständlich |
---
📄 Pfad: `/docs/frontend/config/config.md`