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 // Turnstile site key. Public per Cloudflare (safe to ship to the client).
// read here server-side and passed as a prop so it never needs the PUBLIC_ // IMPORTANT: read from process.env at request time, NOT import.meta.env.
// prefix and stays consistent with TURNSTILE_SECRET_KEY. Undefined when // Astro/Vite statically replaces import.meta.env.* at BUILD time, so the value
// Turnstile is not configured, which makes ContactForm skip the widget entirely. // baked in at build would be "" when the key is supplied at runtime via the
const turnstileSiteKey = import.meta.env.TURNSTILE_SITE_KEY as // container's env_file. process.env is read on each request, so the Docker
string | undefined; // 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 <BaseLayout