Updated key import

This commit is contained in:
Greg Kilmer
2026-07-07 15:56:42 -04:00
parent 2e31aac9bf
commit 738f978120
+8 -6
View File
@@ -56,12 +56,14 @@ const social = [
},
];
// Turnstile site key. Public per Cloudflare (safe to ship to the client), but
// read here server-side and passed as a prop so it never needs the PUBLIC_
// prefix and stays consistent with TURNSTILE_SECRET_KEY. Undefined when
// Turnstile is not configured, which makes ContactForm skip the widget entirely.
const turnstileSiteKey = import.meta.env.TURNSTILE_SITE_KEY as
string | undefined;
// Turnstile site key. Public per Cloudflare (safe to ship to the client).
// IMPORTANT: read from process.env at request time, NOT import.meta.env.
// Astro/Vite statically replaces import.meta.env.* at BUILD time, so the value
// baked in at build would be "" when the key is supplied at runtime via the
// container's env_file. process.env is read on each request, so the Docker
// container picks up the key from .env at runtime. Undefined when Turnstile is
// not configured, which makes ContactForm skip the widget entirely.
const turnstileSiteKey = process.env.TURNSTILE_SITE_KEY;
---
<BaseLayout