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

View File

@@ -15,6 +15,7 @@
"@launchpad/shared": "workspace:*",
"@fastify/cors": "^9.0.1",
"better-sqlite3": "^11.3.0",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.33.0",
"fastify": "^4.28.1"
},

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") });

View File

@@ -1,3 +1,4 @@
import "./env.js";
import Fastify from "fastify";
import cors from "@fastify/cors";
import { ensureSchema } from "./db/client.js";