mirror of
https://github.com/Patiun/com.gregkilmer.www.git
synced 2026-11-08 04:08:24 +00:00
Contact form update
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user