返回 DeepSeek-Reasonix
env.ts
根目录 / workers / accounts / src / env.ts
1 import type { AccountUser } from "./types";
2
3 // Cloudflare's native rate-limit binding (configured under [[unsafe.bindings]]).
4 export interface RateLimiter {
5 limit(opts: { key: string }): Promise<{ success: boolean }>;
6 }
7
8 export interface Bindings {
9 DB: D1Database;
10 AUTH_LIMITER?: RateLimiter;
11
12 // Plain vars (wrangler.toml [vars]).
13 APP_ORIGIN: string;
14 ACCOUNT_ORIGIN: string;
15 ALLOWED_ORIGINS: string;
16 COOKIE_DOMAIN: string;
17 EMAIL_PROVIDER: string;
18 MAIL_FROM: string;
19 ADMIN_EMAILS?: string;
20
21 // Secrets (wrangler secret put ...).
22 SESSION_PEPPER?: string;
23 RESEND_API_KEY?: string;
24 }
25
26 // Per-request values set by middleware. `user` is null until a valid session is
27 // resolved; requireAuth guarantees it is non-null for protected routes.
28 export interface Variables {
29 user: AccountUser | null;
30 }
31
32 export type AppEnv = { Bindings: Bindings; Variables: Variables };
33
33 lines TYPESCRIPT