Skip to content

Commit eb0fc97

Browse files
committed
Add Wrangler binding config to Binding API page
1 parent c6be173 commit eb0fc97

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

src/content/docs/flagship/binding/index.mdx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,26 @@ sidebar:
55
order: 5
66
---
77

8-
import { DirectoryListing } from "~/components";
8+
import { DirectoryListing, WranglerConfig } from "~/components";
99

10-
Workers access Flagship through the `env.FLAGS` binding. The binding provides type-safe methods for evaluating feature flags. If an evaluation fails or a flag is not found, the method returns the default value you provide.
10+
Workers access Flagship through a binding that you add to your Wrangler configuration file. The `binding` field sets the variable name you use in your Worker code.
1111

12-
To add the binding, configure your Wrangler file and run `npx wrangler types` to generate TypeScript types. Refer to [Get started](/flagship/get-started/) for setup instructions.
12+
<WranglerConfig>
13+
14+
```jsonc
15+
{
16+
"flagship": {
17+
"binding": "FLAGS",
18+
"app_id": "<APP_ID>",
19+
},
20+
}
21+
```
22+
23+
</WranglerConfig>
24+
25+
Replace `<APP_ID>` with the app ID from the [Cloudflare dashboard](https://dash.cloudflare.com). With this configuration, the binding is available as `env.FLAGS`. Refer to [Configuration](/flagship/configuration/) for additional options such as binding to multiple apps.
26+
27+
The binding provides type-safe methods for evaluating feature flags. If an evaluation fails or a flag is not found, the method returns the default value you provide.
1328

1429
```ts
1530
export default {

0 commit comments

Comments
 (0)