- console/wrangler.jsonc 填入真实 D1 id + 自定义域名 routes.custom_domain + PUBLIC_BASE_URL - README 生产部署章节补线上实例与自检命令(含 database_id 占位会导致 Invalid uuid 的坑) - 版本号 2.1.1 -> 2.1.2
47 lines
1.5 KiB
JSON
47 lines
1.5 KiB
JSON
// WmailHub Console —— Cloudflare Workers 部署配置(生产)
|
|
// 本地开发不需要 wrangler:直接 `bun run dev`。首次部署前:
|
|
// 1. `bunx wrangler d1 create wmailhub` -> 填 database_id(已完成)
|
|
// 2. `bunx wrangler r2 bucket create wmailhub` (已完成)
|
|
// 3. `bunx wrangler d1 execute wmailhub --remote --file=./migrations/0001_init.sql` 起逐个执行 0001~0004
|
|
// 4. `bunx wrangler secret put SESSION_SECRET` (>=32 位随机串)
|
|
// 5. 配置 CF_OAUTH_CLIENT_ID/SECRET/REDIRECT_URI vars(真实 OAuth;缺省走 sim)
|
|
{
|
|
"$schema": "../node_modules/wrangler/config-schema.json",
|
|
"name": "wmailhub-console",
|
|
"main": "src/worker.ts",
|
|
"compatibility_date": "2026-09-01",
|
|
"assets": {
|
|
"directory": "./public",
|
|
"binding": "ASSETS",
|
|
"not_found_handling": "single-page-application"
|
|
},
|
|
"routes": [
|
|
// 自定义域名:wmailhub.adx9.com(CF 自动创建 DNS 记录并签发证书)
|
|
{
|
|
"pattern": "wmailhub.adx9.com",
|
|
"custom_domain": true
|
|
}
|
|
],
|
|
"d1_databases": [
|
|
{
|
|
"binding": "DB",
|
|
"database_name": "wmailhub",
|
|
"database_id": "cfc47e65-c71e-470f-96db-5bc23e3e31a4"
|
|
}
|
|
],
|
|
"r2_buckets": [
|
|
{
|
|
"binding": "R2",
|
|
"bucket_name": "wmailhub"
|
|
}
|
|
],
|
|
"triggers": {
|
|
// TTL 清理每 15 分钟(docs/09 建议);Webhook 重试每 1 分钟
|
|
"crons": ["*/1 * * * *"]
|
|
},
|
|
"vars": {
|
|
// Console 对外地址;OAuth redirect 需在 Cloudflare Dashboard 登记同一域名
|
|
"PUBLIC_BASE_URL": "https://wmailhub.adx9.com"
|
|
}
|
|
}
|