Skip to content

Commit f8c86a4

Browse files
authored
Make environemnt variables via wrangler clearer (#24321)
1 parent 90cbc00 commit f8c86a4

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/content/docs/workers/ci-cd/builds/configuration.mdx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ sidebar:
66
order: 2
77
---
88

9-
import { DirectoryListing } from "~/components";
9+
import { DirectoryListing, Render, Tabs, TabItem } from "~/components";
1010

1111
When connecting your Git repository to your Worker, you can customize the configurations needed to build and deploy your Worker.
1212

@@ -82,12 +82,26 @@ It is recommended to consistently use the same API token across all uploads and
8282

8383
## Environment variables
8484

85-
You can provide custom environment variables to your build by configuring them in the Cloudflare dashboard:
85+
You can provide custom environment variables to your build.
8686

87-
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
88-
2. In **Account Home**, select **Workers & Pages**.
89-
3. In **Overview**, select your Worker.
90-
4. Select **Settings** > **Environment variables**.
87+
<Tabs>
88+
<TabItem label="Dashboard">
89+
90+
To add environment variables via the dashboard:
91+
92+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
93+
2. In **Account Home**, select **Workers & Pages**.
94+
3. In **Overview**, select your Worker.
95+
4. Select **Settings** > **Environment variables**.
96+
</TabItem>
97+
<TabItem label="Wrangler">
98+
To add env variables using Wrangler, define text and JSON via the `[vars]` configuration in your Wrangler file.
99+
100+
<Render file="envvar-example" />
101+
</TabItem>
102+
</Tabs>
103+
104+
### Default variables
91105

92106
The following system environment variables are injected by default (but can be overridden):
93107

@@ -97,4 +111,4 @@ The following system environment variables are injected by default (but can be o
97111
| `WORKERS_CI` | `1` | Changing build behaviour when run on Workers Builds versus locally |
98112
| `WORKERS_CI_BUILD_UUID` | `<build-uuid-of-current-build>` | Passing the Build UUID along to custom workflows |
99113
| `WORKERS_CI_COMMIT_SHA` | `<sha1-hash-of-current-commit>` | Passing current commit ID to error reporting, for example, Sentry |
100-
| `WORKERS_CI_BRANCH` | `<branch-name-from-push-event` | Customizing build based on branch, for example, disabling debug logging on `production` |
114+
| `WORKERS_CI_BRANCH` | `<branch-name-from-push-event` | Customizing build based on branch, for example, disabling debug logging on `production` |

0 commit comments

Comments
 (0)