Ben Senescu b22dc13b51
Remove direct POSTGRES_DATABASE_URL fallback; Postgres via Hyperdrive only (#351)
The Worker now connects to Postgres exclusively through the HYPERDRIVE
binding. Local dev uses the binding's localConnectionString (committed in
wrangler.jsonc, pointing at the throwaway Docker Postgres from
docs/LOCAL_POSTGRES.md) instead of a POSTGRES_DATABASE_URL Worker var.

Closes the Codex finding about unpooled direct connections from deployed
Workers: the not-recommended direct-connection config is no longer possible.
POSTGRES_DATABASE_URL remains as a Node-side env var for drizzle-kit and
the D1->Postgres migration script only.
2026-07-05 18:11:11 -04:00

69 lines
2.1 KiB
TypeScript

// Custom environment variable type definitions
// These extend the auto-generated Env interface from worker-configuration.d.ts
declare namespace Cloudflare {
interface Env {
R2: R2Bucket;
OAUTH_KV: KVNamespace;
// Durable Object backing the onboarding strategy chat (see wrangler.jsonc).
ONBOARDING_CHAT: DurableObjectNamespace;
// Durable Object backing the SAM in-app agent (see wrangler.jsonc).
SAM_CHAT: DurableObjectNamespace;
AUTH_MODE?: "cloudflare_access" | "local_noauth" | "hosted";
BYPASS_EMAIL_VERIFICATION?: string;
TEAM_DOMAIN?: string;
POLICY_AUD?: string;
POSTHOG_PUBLIC_KEY?: string;
POSTHOG_HOST?: string;
BETTER_AUTH_SECRET?: string;
BETTER_AUTH_URL?: string;
DATABASE_PROVIDER?: "d1" | "postgres";
HYPERDRIVE?: {
connectionString: string;
};
GOOGLE_CLIENT_ID?: string;
GOOGLE_CLIENT_SECRET?: string;
LOOPS_API_KEY?: string;
LOOPS_TRANSACTIONAL_VERIFY_EMAIL_ID?: string;
LOOPS_TRANSACTIONAL_RESET_PASSWORD_ID?: string;
AUTUMN_SECRET_KEY?: string;
AUTUMN_WEBHOOK_SECRET?: string;
// Cloudflare Turnstile — signup captcha (hosted only). Secret verifies
// tokens server-side; site key is public and inlined into the client build.
TURNSTILE_SECRET_KEY?: string;
TURNSTILE_SITE_KEY?: string;
// DataForSEO API Basic auth value (base64 of login:password)
DATAFORSEO_API_KEY: string;
// OpenRouter API key for the in-app chat agents (onboarding + SAM).
OPENROUTER_API_KEY?: string;
// Optional OpenRouter model slug override (defaults in openrouter.ts).
OPENROUTER_MODEL?: string;
}
}
interface ImportMetaEnv {
readonly AUTH_MODE?: "cloudflare_access" | "local_noauth" | "hosted";
readonly DATABASE_PROVIDER?: "d1" | "postgres";
readonly BYPASS_EMAIL_VERIFICATION?: string;
readonly POSTHOG_PUBLIC_KEY?: string;
readonly POSTHOG_HOST?: string;
readonly TURNSTILE_SITE_KEY?: string;
readonly VITE_E2E_DOMAIN_FIXTURES?: string;
readonly VITE_E2E_KEYWORD_FIXTURES?: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}
declare module "*.md?raw" {
const content: string;
export default content;
}