fix: use runtime legal page URLs
This commit is contained in:
1 parent
86dfe8053d
commit
60ef5ddab9
6 files changed
+40
-13
No files matched your search
@@ -27,10 +27,6 @@ ENV SMTP_PORT=587
|
||||
ENV SMTP_USER=portal@localhost
|
||||
ENV SMTP_PASSWORD=dummy-password
|
||||
ENV SMTP_FROM=portal@localhost
|
||||
ENV LEGAL_IMPRINT_URL=https://example.com/impressum
|
||||
ENV LEGAL_PRIVACY_URL=https://example.com/datenschutz
|
||||
ENV LEGAL_TERMS_URL=https://example.com/nutzungsbedingungen
|
||||
|
||||
RUN pnpm build
|
||||
|
||||
FROM node:24-alpine AS runner
|
||||
|
||||
+3
-3
@@ -12,9 +12,9 @@ x-portal-env: &portal-env
|
||||
SMTP_USER: ${SMTP_USER}
|
||||
SMTP_PASSWORD: ${SMTP_PASSWORD}
|
||||
SMTP_FROM: ${SMTP_FROM}
|
||||
LEGAL_IMPRINT_URL: ${LEGAL_IMPRINT_URL}
|
||||
LEGAL_PRIVACY_URL: ${LEGAL_PRIVACY_URL}
|
||||
LEGAL_TERMS_URL: ${LEGAL_TERMS_URL}
|
||||
LEGAL_IMPRINT_URL: ${LEGAL_IMPRINT_URL:-https://leon-tonhaeuser.de/impressum}
|
||||
LEGAL_PRIVACY_URL: ${LEGAL_PRIVACY_URL:-https://leon-tonhaeuser.de/datenschutz}
|
||||
LEGAL_TERMS_URL: ${LEGAL_TERMS_URL:-https://leon-tonhaeuser.de/agb}
|
||||
|
||||
services:
|
||||
portal-db:
|
||||
|
||||
+3
-3
@@ -31,9 +31,9 @@ All production configuration is provided via environment variables (e.g. `.env`
|
||||
| `SMTP_USER` | SMTP username | `portal@example.de` |
|
||||
| `SMTP_PASSWORD` | SMTP password | Confidential |
|
||||
| `SMTP_FROM` | Default From email address | `Leon Tonhäuser Presse <portal@example.de>` |
|
||||
| `LEGAL_IMPRINT_URL` | Public Impressum link | `https://example.de/impressum` |
|
||||
| `LEGAL_PRIVACY_URL` | Public Datenschutz link | `https://example.de/datenschutz` |
|
||||
| `LEGAL_TERMS_URL` | Public Nutzungsbedingungen link | `https://example.de/terms` |
|
||||
| `LEGAL_IMPRINT_URL` | Public Impressum link | `https://leon-tonhaeuser.de/impressum` |
|
||||
| `LEGAL_PRIVACY_URL` | Public Datenschutz link | `https://leon-tonhaeuser.de/datenschutz` |
|
||||
| `LEGAL_TERMS_URL` | Public Nutzungsbedingungen link | `https://leon-tonhaeuser.de/agb` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
@@ -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>;
|
||||
|
||||
Reference in new issue
Block a user