This commit is contained in:
Clove 2026-06-18 23:13:33 +01:00
parent 0499e9da17
commit bc6e91626f
1 changed files with 52 additions and 41 deletions

View File

@ -1,42 +1,53 @@
{ {
// dough-restful — Discord presence + profile API on one Worker. // dough-restful — Discord presence + profile API on one Worker.
// Docs: https://developers.cloudflare.com/workers/wrangler/configuration/ // Docs: https://developers.cloudflare.com/workers/wrangler/configuration/
"$schema": "node_modules/wrangler/config-schema.json", "$schema": "node_modules/wrangler/config-schema.json",
"name": "dough-restful", "name": "dough-restful",
"main": "src/index.ts", "main": "src/index.ts",
"compatibility_date": "2024-09-23", "compatibility_date": "2024-09-23",
"account_id": "f87ee4b9600f437b8da1104d077418c3", "account_id": "f87ee4b9600f437b8da1104d077418c3",
// nodejs_compat is not required; we only use Web/Workers APIs. // nodejs_compat is not required; we only use Web/Workers APIs.
"observability": { "enabled": true }, "observability": {
"enabled": true
// ---- Durable Object: single instance holds the Discord gateway socket ---- },
"durable_objects": { // ---- Durable Object: single instance holds the Discord gateway socket ----
"bindings": [ "durable_objects": {
{ "name": "GATEWAY", "class_name": "GatewayManager" } "bindings": [
] {
}, "name": "GATEWAY",
"migrations": [ "class_name": "GatewayManager"
{ "tag": "v1", "new_classes": ["GatewayManager"] } }
], ]
},
// ---- KV: cache for profile/badge data (not available over the gateway) ---- "migrations": [
// Create with: wrangler kv namespace create PROFILE_CACHE {
// then paste the returned id below. "tag": "v1",
"kv_namespaces": [ "new_sqlite_classes": [
{ "binding": "PROFILE_CACHE", "id": "REPLACE_WITH_KV_ID" } "GatewayManager"
], ]
}
// ---- Cron: nudge the Durable Object so the gateway stays connected ---- ],
"triggers": { // ---- KV: cache for profile/badge data (not available over the gateway) ----
"crons": ["*/2 * * * *"] // Create with: wrangler kv namespace create PROFILE_CACHE
}, // then paste the returned id below.
"kv_namespaces": [
// Non-secret vars. Secrets (tokens) are set via `wrangler secret put`. {
"vars": { "binding": "PROFILE_CACHE",
"DISCORD_API_VERSION": "10", "id": "0ad7fefa9239482a9028c820e4a0cec1"
// Comma-separated guild IDs the bot is in that you want monitored. }
// Leave empty to monitor every guild the bot can see. ],
"TRACKED_GUILD_IDS": "", // ---- Cron: nudge the Durable Object so the gateway stays connected ----
"PROFILE_CACHE_TTL_SECONDS": "300" "triggers": {
} "crons": [
"*/2 * * * *"
]
},
// Non-secret vars. Secrets (tokens) are set via `wrangler secret put`.
"vars": {
"DISCORD_API_VERSION": "10",
// Comma-separated guild IDs the bot is in that you want monitored.
// Leave empty to monitor every guild the bot can see.
"TRACKED_GUILD_IDS": "",
"PROFILE_CACHE_TTL_SECONDS": "300"
}
} }