api/wrangler.toml
54 lines · 1427 bytes
1name = "awesome-privacy-api"
2main = "src/index.workers.ts"
3compatibility_date = "2026-05-01"
4compatibility_flags = ["nodejs_compat"]
5
6# Only reachable via the custom domain, not a *.workers.dev subdomain
7workers_dev = false
8
9# Readable stack traces in observability logs
10upload_source_maps = true
11
12# Custom domain, auto-creates the DNS record on deploy
13[[routes]]
14pattern = "api.awesome-privacy.xyz"
15custom_domain = true
16
17# KV namespaces (populate via `wrangler kv namespace create ...` and paste IDs)
18[[kv_namespaces]]
19binding = "CACHE"
20id = "e0db6722ef6a42f6bb5f609e3ff88f20"
21
22# Rate limit binding (CF Rate Limit API)
23[[unsafe.bindings]]
24name = "RATE_LIMIT"
25type = "ratelimit"
26namespace_id = "1001"
27simple = { limit = 60, period = 60 }
28
29# Stricter limit for anonymous /enrich/* requests; a valid API_TOKEN bypasses it
30[[unsafe.bindings]]
31name = "ENRICH_RATE_LIMIT"
32type = "ratelimit"
33namespace_id = "1002"
34simple = { limit = 10, period = 60 }
35
36# Own limit for anonymous /enrich/trackers requests, which each fetch a web page,
37# kept separate so they never use up the budget of the other enrich routes
38[[unsafe.bindings]]
39name = "TRACKERS_RATE_LIMIT"
40type = "ratelimit"
41namespace_id = "1003"
42simple = { limit = 10, period = 60 }
43
44# Scheduled cache warmer
45[triggers]
46crons = ["*/15 * * * *"]
47
48[vars]
49API_BASE = "https://api.awesome-privacy.xyz"
50
51# Allow observability
52[observability.logs]
53enabled = true
54invocation_logs = true