Skip to content

Commit e76d68d

Browse files
Clarify how wrangler --env affects loading .env and .dev.vars (#19340)
Co-authored-by: Pete Bacon Darwin <[email protected]>
1 parent cdfceee commit e76d68d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/content/docs/workers/wrangler/system-environment-variables.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ System environment variables are local environment variables that can change Wra
1616

1717
3. Set the values in your shell environment. For example, if you are using Z shell, adding `export CLOUDFLARE_API_TOKEN=...` to your `~/.zshrc` file will set this token as part of your shell configuration.
1818

19+
:::note
20+
21+
You can set system environment variables per environment by creating additional files with the naming convention `.env.<environment-name>`. When you set the environment using `wrangler <command> --env <environment-name>`, such an environment specific file will be loaded instead of the `.env` file - they are not merged.
22+
:::
23+
1924
## Supported environment variables
2025

2126
Wrangler supports the following environment variables:

src/content/partials/workers/secrets-in-dev.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ SECRET_KEY="value"
1212
API_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
1313
```
1414

15-
You can set secrets per environment by creating additional files with the naming convention `.dev.vars.<environment-name>`. Like other environment variables, secrets are [non-inheritable](/workers/wrangler/configuration/#non-inheritable-keys) and must be defined per environment.
15+
You can set secrets per environment by creating additional files with the naming convention `.dev.vars.<environment-name>`. When you set the environment using `wrangler <command> --env <environment-name>`, such an environment specific file will be loaded instead of the `.dev.vars` file - they are not merged.
16+
17+
Like other environment variables, secrets are [non-inheritable](/workers/wrangler/configuration/#non-inheritable-keys) and must be defined per environment.

0 commit comments

Comments
 (0)