fix: use runtime legal page URLs

This commit is contained in:
Leon Tonhäuser committed 2026-08-11 16:17:34 +02:00
1 parent 86dfe8053d
commit 60ef5ddab9
6 files changed
+41 -14

No files matched your search

+4
View File
@@ -14,6 +14,10 @@ export const metadata: Metadata = {
description: "Ausgewählte Pressefotos sicher finden und nutzen.",
};
// Legal destinations are runtime configuration. Keep the shared layout
// dynamic so Docker build-time placeholders can never be baked into pages.
export const dynamic = "force-dynamic";
export default function RootLayout({ children }: Readonly<{ children: ReactNode }>) {
return (
<html lang="de" suppressHydrationWarning>
+23
View File
@@ -7,4 +7,27 @@ describe("parseServerEnv", () => {
/IMMICH_API_KEY/,
);
});
test("uses the production legal pages when no overrides are configured", () => {
const parsed = parseServerEnv({
DATABASE_URL: "postgres://portal:secret@portal-db:5432/portal",
BETTER_AUTH_SECRET: "test-secret-at-least-thirty-two-characters",
BETTER_AUTH_URL: "https://redaktionen.leon-tonhaeuser.de",
IMMICH_BASE_URL: "http://immich-server:2283",
IMMICH_API_KEY: "test-immich-key",
SMTP_HOST: "smtp.example.com",
SMTP_PORT: "587",
SMTP_USER: "portal@example.com",
SMTP_PASSWORD: "test-smtp-password",
SMTP_FROM: "portal@example.com",
});
expect(parsed.LEGAL_IMPRINT_URL).toBe(
"https://leon-tonhaeuser.de/impressum",
);
expect(parsed.LEGAL_PRIVACY_URL).toBe(
"https://leon-tonhaeuser.de/datenschutz",
);
expect(parsed.LEGAL_TERMS_URL).toBe("https://leon-tonhaeuser.de/agb");
});
});
+7 -3
View File
@@ -13,9 +13,13 @@ const serverEnvSchema = z.object({
SMTP_USER: z.string().min(1),
SMTP_PASSWORD: z.string().min(1),
SMTP_FROM: z.string().min(1),
LEGAL_IMPRINT_URL: z.url(),
LEGAL_PRIVACY_URL: z.url(),
LEGAL_TERMS_URL: z.url(),
LEGAL_IMPRINT_URL: z
.url()
.default("https://leon-tonhaeuser.de/impressum"),
LEGAL_PRIVACY_URL: z
.url()
.default("https://leon-tonhaeuser.de/datenschutz"),
LEGAL_TERMS_URL: z.url().default("https://leon-tonhaeuser.de/agb"),
});
export type ServerEnv = z.infer<typeof serverEnvSchema>;