.env commit

This commit is contained in:
Basilosaurusrex committed 2026-02-06 19:46:26 +01:00
1 parent 82668796d6
commit 305de38ff6
5 files changed
+108 -4

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env node
/**
* Legt .env aus .env.example an, falls .env noch nicht existiert.
* .cjs damit es unter "type": "module" (package.json) mit require() läuft.
* Für Deployment: deploy.sh kann vor dem Build .env.local aus Container-Env schreiben.
*/
const fs = require("fs");
const path = require("path");
const envPath = path.join(process.cwd(), ".env");
const examplePath = path.join(process.cwd(), ".env.example");
if (fs.existsSync(envPath)) {
console.log(".env existiert bereits – nichts geändert.");
process.exit(0);
}
if (!fs.existsSync(examplePath)) {
console.error(".env.example nicht gefunden. Bitte manuell .env anlegen.");
process.exit(1);
}
fs.copyFileSync(examplePath, envPath);
console.log(".env wurde aus .env.example erstellt. Bitte danach 'npm run build' ausführen.");
process.exit(0);