Skip to content
Cloudflare Docs

Configuration

Background

Your project will need some configuration before you can publish your Worker. Configuration is done through changes to keys and values stored in a Wrangler file located in the root of your project directory. You must manually edit this file to edit your keys and values before you can publish.


Environments

The top-level configuration is the collection of values you specify at the top of your Wrangler file. These values will be inherited by all environments, unless otherwise defined in the environment.

The layout of a top-level configuration in a Wrangler file is displayed below:

{
"name": "your-worker",
"type": "javascript",
"account_id": "your-account-id",
"workers_dev": true,
"zone_id": "your-zone-id",
"routes": [
"example.com/*"
]
}

Environment configuration (optional): the configuration values you specify under an [env.name] in your Wrangler file.

Environments allow you to deploy the same project to multiple places under multiple names. These environments are utilized with the --env or -e flag on the commands that are deploying live Workers:

  • build
  • dev
  • preview
  • publish
  • secret

Some environment properties can be inherited from the top-level configuration, but if new values are configured in an environment, they will always override those at the top level.

An example of an [env.name] configuration looks like this: