Deploy a Worker to a specific environment

deploy & domains

// what it does

Selects the [env.<name>] block in your config so that environment's name, vars, routes, and bindings are used. This is how you keep staging and production separate from a single config file. --env also picks the matching .env / .dev.vars file for that environment.

// shell

$ wrangler deploy --env production
$ wrangler deploy -e staging

// gotcha

An env-scoped Worker is named <worker>-<env> (e.g. api-staging) unless you set an explicit name inside the env block — miss this and you can create a surprise Worker or overwrite the wrong one.