What the Worker is bound to
Everything Cloudflare gives this Worker by name: its databases, buckets and queues, its variables, and the names of its secrets.
Written by charter from wrangler.jsonc, .dev.vars.example and fnox.toml: it is what the app has now, and changes when that does.
Each is a value in the app's Go under the same name (env.DB, env.APP_NAME), so one that is not here cannot be used. A secret's value is never in the repository, and never here.
| In Go | |
|---|---|
| D1 databases (wrangler.jsonc's d1_databases): Open is the database, for the queries. | env.DB |
| KV namespaces (kv_namespaces): Open is workers-go's *kv.Namespace. | env.KV |
| R2 buckets (r2_buckets): Open is workers-go's *r2.Bucket. | env.BUCKET |
| Queues the Worker sends to (queues.producers): Open is workers-go's *queues.Producer. | env.QUEUE |
| Durable Object namespaces (durable_objects.bindings): what a live.Feed's hub is in. | env.HUB |
| Rate limits (ratelimits), with the calls and the seconds wrangler.jsonc says: Allow asks one. | env.WRITE_LIMIT |
| Email out (send_email): Send sends through one. | env.MAIL |
| Variables (wrangler.jsonc's vars): Value is what one holds. | env.APP_NAME, env.MAIL_FROM, env.MAIL_UNLIMITED |
| Secrets (.dev.vars.example, fnox.toml), by name: Value is what one holds on the Worker, never in the repository. | env.ADMIN_TOKEN, env.MAIL_TO, env.READ_TOKEN, env.WRITE_TOKEN |