From 738f97812030be93b8f4d3391ed1f04ffc00468a Mon Sep 17 00:00:00 2001 From: Greg Kilmer Date: Tue, 7 Jul 2026 15:56:42 -0400 Subject: [PATCH] Updated key import --- src/pages/contact.astro | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/contact.astro b/src/pages/contact.astro index 46f9394..201bb22 100644 --- a/src/pages/contact.astro +++ b/src/pages/contact.astro @@ -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; ---