Zentrale .env-Konfiguration für alle Umgebungsvariablen

This commit is contained in:
2026-07-19 02:35:29 +02:00
parent 28bccb9d16
commit b0ff551ca0
7 changed files with 88 additions and 13 deletions

11
apps/backend/src/env.ts Normal file
View File

@@ -0,0 +1,11 @@
import { config } from "dotenv";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
const currentDir = dirname(fileURLToPath(import.meta.url));
// apps/backend/src/env.ts (bzw. apps/backend/dist/env.js) -> Repo-Root liegt
// drei Verzeichnisebenen höher. Existiert dort keine .env (z. B. im
// Docker-Image), passiert einfach nichts die Werte kommen dann bereits aus
// der Container-Umgebung (docker-compose env_file/environment).
config({ path: resolve(currentDir, "../../../.env") });