- Add @opennextjs/cloudflare + wrangler config, open-next.config.ts, public/_headers, .dev.vars.example template - package.json: cf build/preview/deploy/upload scripts - Verified deployed: https://forumlify.roylikerebecca19930.workers.dev (DB read/write via outbound TCP to Postgres, R2 image upload + public domain access all working)
# Cloudflare Workers 环境变量示例
|
||
# 复制为 .dev.vars 用于本地 preview;远程部署请在 CF 面板配置为 Secrets
|
||
|
||
DATABASE_URL=postgresql://user:pass@host:5432/forumlify
|
||
JWT_SECRET=change-me-in-production
|
||
|
||
# 图片上传(S3 兼容,R2)
|
||
S3_ENDPOINT=https://<account_id>.r2.cloudflarestorage.com
|
||
S3_BUCKET=forum
|
||
S3_REGION=auto
|
||
S3_ACCESS_KEY_ID=your-r2-access-key
|
||
S3_SECRET_ACCESS_KEY=your-r2-secret-key
|
||
S3_PUBLIC_URL=https://your-public-domain.example
|