feat: add Cloudflare Workers deployment support

- Create src/worker.ts: Workers-compatible relay handler using env
  bindings instead of process.env, exports { fetch } for Workers runtime
- Update wrangler.toml: point to new src/worker.ts entry point
- Update deploy.yml: add wrangler-action deploy step after tests pass
- The worker reuses the same relay logic from src/lib/ and src/middleware/

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-10 21:38:22 +07:00
co-authored by Claude Fable 5
parent 5552ee2118
commit 7a4df35371
3 changed files with 407 additions and 6 deletions
+11 -6
View File
@@ -1,10 +1,15 @@
name = "edge-proxy-relay"
main = "src/index.ts"
compatibility_date = "2024-12-01"
main = "src/worker.ts"
compatibility_date = "2025-12-01"
compatibility_flags = ["nodejs_compat"]
[vars]
NODE_VERSION = "22"
# ── Cloudflare account (fill in your Account ID) ─────────────────────────────
# Find it in the Cloudflare Dashboard → Workers & Pages → right sidebar
# account_id = ""
# workers_dev = true
[env.production]
name = "edge-proxy-relay-prod"
# ── Environment Variables ───────────────────────────────────────────────────
# [vars]
# RELAY_TIMEOUT_MS = "30000"
# RATE_LIMIT_MAX = "200"
# RATE_LIMIT_WINDOW_MS = "60000"