Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
17 lines
567 B
JavaScript
17 lines
567 B
JavaScript
import { existsSync, writeFileSync } from "node:fs";
|
|
import { randomBytes } from "node:crypto";
|
|
|
|
if (existsSync(".env")) {
|
|
console.log(".env existiert bereits und wurde nicht veraendert.");
|
|
} else {
|
|
const password = randomBytes(24).toString("hex");
|
|
writeFileSync(".env", [
|
|
`DATABASE_URL=postgresql://kibu:${password}@127.0.0.1:55432/kibu`,
|
|
`POSTGRES_PASSWORD=${password}`,
|
|
"APP_TIMEZONE=Europe/Berlin",
|
|
"SESSION_SECURE=false",
|
|
"",
|
|
].join("\n"), { flag: "wx" });
|
|
console.log(".env mit zufaelligem lokalen Datenbankpasswort erstellt.");
|
|
}
|