generated from Dicken/dickendock
Zentrale .env-Konfiguration für alle Umgebungsvariablen
This commit is contained in:
@@ -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
11
apps/backend/src/env.ts
Normal 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") });
|
||||
@@ -1,3 +1,4 @@
|
||||
import "./env.js";
|
||||
import Fastify from "fastify";
|
||||
import cors from "@fastify/cors";
|
||||
import { ensureSchema } from "./db/client.js";
|
||||
|
||||
Reference in New Issue
Block a user