Contact form update

This commit is contained in:
Greg Kilmer
2026-07-07 21:58:37 -04:00
parent 738f978120
commit e7c5e9d66e
4 changed files with 176 additions and 44 deletions
+7 -7
View File
@@ -17,6 +17,7 @@ import SectionHeader from "@components/layout/SectionHeader.astro";
import Placeholder from "@components/layout/Placeholder.astro";
import ContactForm from "@components/professional/ContactForm.tsx";
import ObfuscatedEmail from "@components/ObfuscatedEmail.astro";
import { turnstileSiteKey as getTurnstileSiteKey } from "@lib/env";
// Email is rendered separately via <ObfuscatedEmail> so the plaintext address
// never appears in the HTML source. The other entries are plain links.
@@ -57,13 +58,12 @@ const social = [
];
// 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;
// Read via the env helper so it resolves in BOTH `astro dev` (Vite loads `.env`
// into import.meta.env) AND the Docker runtime (env_file sets process.env).
// See src/lib/env.ts for why neither source alone covers both runtimes.
// Undefined when Turnstile is not configured, which makes ContactForm skip the
// widget entirely.
const turnstileSiteKey = getTurnstileSiteKey();
---
<BaseLayout