feat: basePath-Konfiguration von .env in config.json verschoben
basePath wird jetzt in config.json gepflegt statt als NEXT_PUBLIC_BASE_PATH in .env.* Alle relevanten Code-Stellen lesen basePath dynamisch aus config.json Dokumentation und Beispiele in Markdown-Dateien entsprechend angepasst Erhöhte Flexibilität für Deployments ohne Rebuild
This commit is contained in:
@@ -87,7 +87,7 @@ sequenceDiagram
|
||||
|
||||
- **Konfigurierbarer basePath:**
|
||||
- **Konfigurierbarer basePath:**
|
||||
Pfad wie `/talas5` ist optional und kann per Umgebungsvariable `NEXT_PUBLIC_BASE_PATH` gesetzt
|
||||
Pfad wie `/talas5` ist optional und wird jetzt in `public/config.json` als `basePath` gepflegt
|
||||
werden.
|
||||
Die Konfiguration erfolgt je nach Umgebung über:
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
# 📁 paths.js
|
||||
|
||||
Berechnet den sauberen `BASE_URL`-Pfad basierend auf `.env.production` oder
|
||||
`.env.development → NEXT_PUBLIC_BASE_PATH`.
|
||||
`public/config.json → basePath`.
|
||||
Entfernt führende und abschließende Slashes.
|
||||
|
||||
## Beispiel
|
||||
|
||||
Wenn `NEXT_PUBLIC_BASE_PATH = "/talas5/"`, wird `BASE_URL = "/talas5"` gesetzt.
|
||||
Wenn `basePath = "/talas5/"` in config.json gesetzt ist, wird `BASE_URL = "/talas5"` verwendet.
|
||||
|
||||
```js
|
||||
const BASE_PATH = basePathRaw.replace(/^\/|\/$/g, "");
|
||||
|
||||
@@ -12,17 +12,17 @@ NodeMap verwendet Umgebungsvariablen zur Steuerung von API-Verhalten, Serverpfad
|
||||
|
||||
## 🔧 Wichtige Variablen
|
||||
|
||||
| Variable | Beispielwert | Beschreibung |
|
||||
| --------------------------- | ------------------- | --------------------------------------------------------------------- |
|
||||
| `DB_HOST` | `localhost` | Adresse des Datenbankservers (MySQL) |
|
||||
| `DB_PORT` | `3306` | Port für die Datenbankverbindung |
|
||||
| `DB_NAME` | `talas` | Datenbankname |
|
||||
| `DB_USER` | `root` | Benutzername für MySQL |
|
||||
| `DB_PASSWORD` | `geheim` | Passwort für MySQL |
|
||||
| `NEXT_PUBLIC_API_PORT_MODE` | `prod` oder `dev` | Steuert API-Routing bei Services (z. B. Portwechsel für lokal) |
|
||||
| `NEXT_PUBLIC_USE_MOCKS` | `true` oder `false` | Aktiviert den Mockdaten-Modus über `/api/mocks/...` |
|
||||
| `NEXT_PUBLIC_BASE_PATH` | `/talas5` oder leer | Optionaler Pfad, falls App unter Subpfad läuft (z. B. IIS) |
|
||||
| `NEXT_PUBLIC_DEBUG` | `true` oder `false` | Aktiviert zusätzliche `console.log` Ausgaben für Debugging im Browser |
|
||||
| Variable | Beispielwert | Beschreibung |
|
||||
| --------------------------- | ------------------- | -------------------------------------------------------------------------------------------------------- |
|
||||
| `DB_HOST` | `localhost` | Adresse des Datenbankservers (MySQL) |
|
||||
| `DB_PORT` | `3306` | Port für die Datenbankverbindung |
|
||||
| `DB_NAME` | `talas` | Datenbankname |
|
||||
| `DB_USER` | `root` | Benutzername für MySQL |
|
||||
| `DB_PASSWORD` | `geheim` | Passwort für MySQL |
|
||||
| `NEXT_PUBLIC_API_PORT_MODE` | `prod` oder `dev` | Steuert API-Routing bei Services (z. B. Portwechsel für lokal) |
|
||||
| `NEXT_PUBLIC_USE_MOCKS` | `true` oder `false` | Aktiviert den Mockdaten-Modus über `/api/mocks/...` |
|
||||
| `basePath` (in config.json) | `/talas5` oder leer | Optionaler Pfad, falls App unter Subpfad läuft (z. B. IIS). Wird jetzt in `public/config.json` gepflegt. |
|
||||
| `NEXT_PUBLIC_DEBUG` | `true` oder `false` | Aktiviert zusätzliche `console.log` Ausgaben für Debugging im Browser |
|
||||
|
||||
## 📦 Beispiel `.env.production`
|
||||
|
||||
@@ -34,7 +34,11 @@ DB_USER=root
|
||||
DB_PASSWORD=geheim
|
||||
NEXT_PUBLIC_API_PORT_MODE=prod
|
||||
NEXT_PUBLIC_USE_MOCKS=false
|
||||
NEXT_PUBLIC_BASE_PATH=/talas5
|
||||
// public/config.json
|
||||
{
|
||||
...
|
||||
"basePath": "/talas5"
|
||||
}
|
||||
NEXT_PUBLIC_DEBUG=false
|
||||
```
|
||||
|
||||
@@ -48,7 +52,11 @@ DB_USER=root
|
||||
DB_PASSWORD=geheim
|
||||
NEXT_PUBLIC_API_PORT_MODE=dev
|
||||
NEXT_PUBLIC_USE_MOCKS=true
|
||||
NEXT_PUBLIC_BASE_PATH=/talas5
|
||||
// public/config.json
|
||||
{
|
||||
...
|
||||
"basePath": "/talas5"
|
||||
}
|
||||
NEXT_PUBLIC_DEBUG=true
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user