Environments provide isolated spaces where your code runs with specific dependencies and configurations. This can be useful for a number of reasons, such as compatibility testing or version management. Using different environments can help with code consistency, testing, and production segregation, which reduces the risk of errors when deploying code.
Wrangler allows you to deploy the same Worker application with different configuration for each environment.
If you are using Wrangler environments, you must specify any Durable Object bindings you wish to use on a per-environment basis.
Durable Object bindings are not inherited. For example, you can define an environment named staging as below:
{
"env": {
"staging": {
"durable_objects": {
"bindings": [
{
"name": "EXAMPLE_CLASS",
"class_name": "DurableObjectExample"
}
]
}
}
}
}[[env.staging.durable_objects.bindings]]
name = "EXAMPLE_CLASS"
class_name = "DurableObjectExample"