Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

chore(env): use Cloudflare's Turnstile test keys on a local stack

Sidwebworks8fedb4b30c06
diff --git a/packages/env/src/index.ts b/packages/env/src/index.ts
index 19ab99ff3e..bfc5edaaa4 100644
--- a/packages/env/src/index.ts
+++ b/packages/env/src/index.ts
@@ -162,17 +162,6 @@ export const CARBON_API_URL =
isSecret: false
}) ?? getEnv("SUPABASE_URL", { isSecret: false });
-// Turnstile guards login wherever BotID can't run (anything not on Vercel).
-// Both keys or neither: a site key alone would render a widget nobody checks.
-export const CLOUDFLARE_TURNSTILE_SITE_KEY = getEnv(
- "CLOUDFLARE_TURNSTILE_SITE_KEY",
- { isRequired: false, isSecret: false }
-);
-export const CLOUDFLARE_TURNSTILE_SECRET_KEY = getEnv(
- "CLOUDFLARE_TURNSTILE_SECRET_KEY",
- { isRequired: false }
-);
-
export const DOMAIN = getEnv("DOMAIN", { isRequired: false }); // preview environments need no domain
export const EXCHANGE_RATES_API_KEY = getEnv("EXCHANGE_RATES_API_KEY", {
@@ -485,6 +474,21 @@ export const IS_LOCAL_DEV =
VERCEL_ENV !== "production" &&
VERCEL_ENV !== "preview";
+// Turnstile guards login wherever BotID can't run (anything not on Vercel).
+// Both keys or neither: a site key alone would render a widget nobody checks.
+// A local stack always uses Cloudflare's always-pass test pair, so login works
+// with no Turnstile account; the two only pass together.
+// https://developers.cloudflare.com/turnstile/troubleshooting/testing/
+export const CLOUDFLARE_TURNSTILE_SITE_KEY = IS_LOCAL_DEV
+ ? "1x00000000000000000000AA"
+ : getEnv("CLOUDFLARE_TURNSTILE_SITE_KEY", {
+ isRequired: false,
+ isSecret: false
+ });
+export const CLOUDFLARE_TURNSTILE_SECRET_KEY = IS_LOCAL_DEV
+ ? "1x0000000000000000000000000000000AA"
+ : getEnv("CLOUDFLARE_TURNSTILE_SECRET_KEY", { isRequired: false });
+
// Set to "1" by Vercel itself on every build and function — never by SST,
// Docker, or a local stack, which all set VERCEL_ENV by hand. Server-only.
export const IS_VERCEL =