feat: add Docker support with demo mode and database reset functionality

This commit is contained in:
Paul Schoeneck committed 2026-11-03 08:50:48 +01:00
1 parent 75af38a4b6
commit 373b9278d1
12 files changed
+248 -5

No files matched your search

+2 -1
View File
@@ -7,6 +7,7 @@ import { spawnSync } from "node:child_process";
import { createRequire } from "node:module";
import { fileURLToPath } from "node:url";
import { db } from "../src/lib/db";
import { isDemoDatabase } from "../src/lib/demo";
async function reset() {
const [mode, confirmation, ...extra] = process.argv.slice(2);
@@ -16,7 +17,7 @@ async function reset() {
if (!process.env.DATABASE_URL) throw new Error("DATABASE_URL fehlt. Zuerst npm run configure ausfuehren.");
const target = new URL(process.env.DATABASE_URL);
if (!["postgres:", "postgresql:"].includes(target.protocol)
|| !["localhost", "127.0.0.1", "[::1]"].includes(target.hostname)
|| (!["localhost", "127.0.0.1", "[::1]"].includes(target.hostname) && !isDemoDatabase(target))
|| !target.pathname.slice(1) || ["/postgres", "/template0", "/template1"].includes(target.pathname)) {
throw new Error("Reset nur fuer eine ausdruecklich konfigurierte lokale Anwendungsdatenbank erlaubt.");
}