feat: add production readiness checks

This commit is contained in:
Codex
2026-06-29 10:34:12 +08:00
parent d89f77e9af
commit e587a0c955
10 changed files with 564 additions and 32 deletions

View File

@@ -158,6 +158,7 @@ npm run check:api
npm run check:worker
npm run check:importer
npm run pb:import:validate
npm run test:readiness
npm run test:api
npm run test:worker:crm
npm run test:worker:commerce
@@ -166,6 +167,22 @@ npm run test:worker:imports
npm run test:worker:public-banks
```
## 生产就绪检查
填好生产 `.env` 后,先跑环境变量级检查:
```bash
npm run readiness:production
```
确认 `DATABASE_URL` 指向生产 Supabase/PostgreSQL 后,再跑数据库配置检查:
```bash
npm run readiness:production:db
```
这个检查会阻断默认弱密钥、`CORS=*`、mock 短信、legacy 身份头、local_dev 存储、对象存储未配置、CRM insecure localhost 等生产风险;带 `:db` 的版本还会检查租户 provider 公开配置是否混入密钥、活跃短信/OAuth/支付 provider 是否缺少 `app_private.tenant_secrets`、域名是否未验证。
## API 模块
当前 API 目录:
@@ -214,6 +231,7 @@ API 身份上下文:
```text
npx supabase db reset
npm run check:refactor
npm run test:readiness
npm run test:worker:imports
npm run test:worker:crm
npm run test:worker:commerce