- ThrottlerGuard runs first, so requests with wrong tokens or API keys count against the rate limit before any database lookup. - TRUST_PROXY (hop count or Express list) replaces the hard-coded 1. - Every API answer except the public lot pages is Cache-Control: no-store without ETag; helmet sends default-src 'none' / frame-ancestors 'none' (Swagger keeps the page policy when enabled) and same-site CORP. - Request log lines carry the path only - no query strings (the SSO callback's code and state no longer reach the logs). - In production the server refuses to start without an https FRONTEND_ORIGIN or with COOKIE_SECURE=false. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
80 lines
4.1 KiB
Bash
80 lines
4.1 KiB
Bash
# Kopieren nach .env und mit echten Werten befuellen. .env ist gitignored.
|
|
|
|
DATABASE_URL="postgresql://user:password@localhost:5432/apicore?schema=public"
|
|
|
|
# Mindestens 32 Zeichen (server-seitig erzwungen, siehe main.ts) - signiert
|
|
# jedes Access-/MFA-/SSO-Token UND verschluesselt gespeicherte TOTP-Secrets.
|
|
# Erzeugen z.B. mit: openssl rand -hex 32
|
|
JWT_ACCESS_SECRET="change-me-to-a-random-value-at-least-32-characters-long"
|
|
JWT_REFRESH_SECRET="change-me-refresh-secret"
|
|
JWT_ACCESS_EXPIRES_IN="15m"
|
|
JWT_REFRESH_EXPIRES_IN="7d"
|
|
# Hard limit from login, however often the session is refreshed.
|
|
SESSION_MAX_AGE="7d"
|
|
|
|
PORT=3001
|
|
FRONTEND_ORIGIN="http://localhost:3000"
|
|
# Reverse-proxy hops in front of the backend whose X-Forwarded-For is
|
|
# trusted (client IP for rate limits and API-key IP allowlists). "1" for the
|
|
# single K8s ingress; a list such as "loopback, 10.0.0.0/8" also works.
|
|
TRUST_PROXY=1
|
|
|
|
# Refresh-token cookie requires HTTPS by default. Set to "false" only for
|
|
# local HTTP development - every real deployment must leave this unset (or
|
|
# "true").
|
|
COOKIE_SECURE=false
|
|
|
|
# Lokales Verzeichnis fuer hochgeladene Dokumente/Bilder (Modul 29).
|
|
# Bei horizontaler Skalierung (>1 Replica) muss dies auf ein geteiltes
|
|
# Volume (z.B. ReadWriteMany-PVC) zeigen, siehe ARCHITECTURE.md Annahme 7.
|
|
DOCUMENTS_STORAGE_PATH="./uploads"
|
|
|
|
# Automatische Backups (Modul Backup). Alle drei Werte sind auch ueber die
|
|
# GUI (Verwaltung > Backup) konfigurierbar - eine hier gesetzte Env-Variable
|
|
# hat aber IMMER Vorrang vor dem GUI-Wert, pro Feld einzeln. Ohne Pfad
|
|
# (weder Env noch GUI) bleibt der Zeitplan deaktiviert (nur manueller
|
|
# Export/Import ueber die UI verfuegbar).
|
|
# Bei horizontaler Skalierung (>1 Replica) muss der Pfad auf ein geteiltes
|
|
# Volume zeigen (wie DOCUMENTS_STORAGE_PATH), sonst sieht jede Replica nur
|
|
# ihre eigenen Backup-Dateien und die Lauf-Erkennung zwischen Replicas greift
|
|
# nicht.
|
|
BACKUP_STORAGE_PATH="./backups"
|
|
# Directory a backup path set in the admin UI must stay under (the env
|
|
# variable above is not restricted). Default "./backups".
|
|
# BACKUP_ROOT="./backups"
|
|
# Cron-Ausdruck (Standard: taeglich um 03:00 Uhr).
|
|
BACKUP_CRON_SCHEDULE="0 3 * * *"
|
|
# Wie viele der neuesten Backup-Dateien behalten werden, aeltere werden nach
|
|
# jedem Lauf geloescht (Standard: 14).
|
|
BACKUP_RETENTION_COUNT=14
|
|
# Backups are encrypted (AES-256-GCM). Without this key they are sealed with a
|
|
# key derived from JWT_ACCESS_SECRET and restore only into this deployment.
|
|
# Set the same value on another deployment to restore there. At least 32
|
|
# characters, e.g. "openssl rand -hex 32". Keep it outside the backup storage.
|
|
# BACKUP_ENCRYPTION_KEY=""
|
|
|
|
# Entra ID SSO. Ohne alle vier Werte bleibt SSO deaktiviert
|
|
# (GET /api/v1/auth/sso/status meldet enabled: false, kein Fehler beim Start).
|
|
# OIDC_ISSUER_URL ist die v2.0-Metadaten-URL des Tenants, OIDC_REDIRECT_URI
|
|
# muss exakt der in der App-Registrierung hinterlegten Redirect-URI entsprechen.
|
|
#
|
|
# Dieselbe App-Registrierung wird auch fuer die M365-Kalender-Synchronisation
|
|
# (Modul Kalender) wiederverwendet - kein zweites Enterprise-App-Objekt noetig.
|
|
# Dafuer in der App-Registrierung zusaetzlich die Application-Permission
|
|
# "Calendars.ReadWrite" hinzufuegen (Admin-Consent noetig); die Tenant-ID wird
|
|
# aus OIDC_ISSUER_URL abgeleitet. Eintraege (Aufgaben, Durchsichten,
|
|
# Behandlungen, Fuetterungen, Ernten, Koeniginnen-Zuordnungen) werden
|
|
# einseitig (ApiCore -> M365) in den Kalender einer Microsoft-365-Gruppe
|
|
# uebertragen. Ohne diese drei Werte bleibt die Synchronisation deaktiviert;
|
|
# zusaetzlich muessen die Synchronisation selbst UND die jeweilige Gruppen-ID
|
|
# in der GUI (Verwaltung > Automatisierung > Kalender-Sync) gesetzt werden.
|
|
OIDC_ISSUER_URL="https://login.microsoftonline.com/<tenant-id>/v2.0"
|
|
OIDC_CLIENT_ID="change-me-entra-client-id"
|
|
OIDC_CLIENT_SECRET="change-me-entra-client-secret"
|
|
OIDC_REDIRECT_URI="http://localhost:3001/api/v1/auth/sso/callback"
|
|
|
|
# Swagger-UI unter /api/v1/docs ist per Default deaktiviert, da sie das
|
|
# gesamte API-Schema ungeschuetzt (kein JwtAuthGuard) preisgeben wuerde.
|
|
# Nur fuer lokale Entwicklung/Debugging explizit aktivieren.
|
|
ENABLE_SWAGGER=false
|