From 15620f8632b34084b849e795bb4360c46d88087d Mon Sep 17 00:00:00 2001 From: seaHi Date: Fri, 7 Aug 2026 13:45:16 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=B0=86=20Cloudflare=20Access=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=A7=BB=E8=87=B3=20wrangler.jsonc=20?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dev.vars.example | 6 +++--- src/app.d.ts | 5 +---- worker-configuration.d.ts | 12 +++++++++++- wrangler.jsonc | 4 ++++ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.dev.vars.example b/.dev.vars.example index 9899ea5..ef56a4f 100644 --- a/.dev.vars.example +++ b/.dev.vars.example @@ -1,3 +1,3 @@ -# Required when exercising production-mode admin routes locally. -CF_ACCESS_TEAM_DOMAIN=https://your-team.cloudflareaccess.com -CF_ACCESS_AUD=your-access-application-audience +# Optional local overrides. The deployed values live in wrangler.jsonc. +CF_ACCESS_TEAM_DOMAIN=https://hisland.cloudflareaccess.com +CF_ACCESS_AUD=35b84a1c6ea81e1c036272ee68ecc4197041aadc1bed0815accac283a30e01ff diff --git a/src/app.d.ts b/src/app.d.ts index a79f138..f83fb02 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -3,10 +3,7 @@ declare global { namespace App { interface Platform { - env: Env & { - CF_ACCESS_TEAM_DOMAIN?: string; - CF_ACCESS_AUD?: string; - }; + env: Env; context: ExecutionContext; caches: CacheStorage & { default: Cache }; cf?: IncomingRequestCfProperties; diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index e664b91..78b5592 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -1,14 +1,24 @@ /* eslint-disable */ -// Generated by Wrangler by running `wrangler types` (hash: 595eaffe197c5cd34fd594e9940c7cf0) +// Generated by Wrangler by running `wrangler types` (hash: 8e316e5cc1c036c1cc1ec926e6667c6d) // Runtime types generated with workerd@1.20260801.1 2026-08-07 nodejs_compat interface __BaseEnv_Env { R2: R2Bucket; DB: D1Database; + CF_ACCESS_TEAM_DOMAIN: 'https://hisland.cloudflareaccess.com'; + CF_ACCESS_AUD: '35b84a1c6ea81e1c036272ee68ecc4197041aadc1bed0815accac283a30e01ff'; } declare namespace Cloudflare { interface Env extends __BaseEnv_Env {} } interface Env extends __BaseEnv_Env {} +type StringifyValues> = { + [Binding in keyof EnvType]: EnvType[Binding] extends string ? EnvType[Binding] : string; +}; +declare namespace NodeJS { + interface ProcessEnv extends StringifyValues< + Pick + > {} +} // Begin runtime types /*! ***************************************************************************** diff --git a/wrangler.jsonc b/wrangler.jsonc index da2ae74..48d645f 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -4,6 +4,10 @@ "compatibility_date": "2026-08-07", "compatibility_flags": ["nodejs_compat"], "pages_build_output_dir": ".svelte-kit/cloudflare", + "vars": { + "CF_ACCESS_TEAM_DOMAIN": "https://hisland.cloudflareaccess.com", + "CF_ACCESS_AUD": "35b84a1c6ea81e1c036272ee68ecc4197041aadc1bed0815accac283a30e01ff" + }, "d1_databases": [ { "binding": "DB",