Skip to content

Commit

Permalink
[wrangler] replace mentions of wrangler.json with wrangler.json(c) (#…
Browse files Browse the repository at this point in the history
…19764)

* update references of wrangler.json to wrangler.json(c)

* change to wrangler config file with link

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

---------

Co-authored-by: Jun Lee <[email protected]>
  • Loading branch information
emily-shen and Oxyjun authored Feb 12, 2025
1 parent 406616f commit 98fcddb
Show file tree
Hide file tree
Showing 143 changed files with 338 additions and 323 deletions.
2 changes: 1 addition & 1 deletion src/components/WranglerConfig.astro
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if (language === "toml") {
---

<Tabs syncKey="wranglerConfig">
<TabItem label="wrangler.json" icon="seti:json">
<TabItem label="wrangler.jsonc" icon="seti:json">
<Code lang="jsonc" code={json} />
</TabItem>
<TabItem label="wrangler.toml" icon="setting">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ date: 2025-01-30T14:00:00Z

We have released new [Workers bindings API methods](/ai-gateway/integrations/worker-binding-methods/), allowing you to connect Workers applications to AI Gateway directly. These methods simplify how Workers calls AI services behind your AI Gateway configurations, removing the need to use the REST API and manually authenticate.

To add an AI binding to your Worker, include the following in your `wrangler.toml` or `wrangler.json` file:
To add an AI binding to your Worker, include the following in your [Wrangler configuration file](/workers/wrangler/configuration/):

![Add an AI binding to your Worker.](~/assets/images/ai-gateway/add-binding.png)

Expand Down
2 changes: 1 addition & 1 deletion src/content/changelogs/queues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ entries:
description: |-
Queue consumers will soon automatically scale up concurrently as a queues' backlog grows in order to keep overall message processing latency down. Concurrency will be enabled on all existing queues by 2023-03-28.
**To opt-out, or to configure a fixed maximum concurrency**, set `max_concurrency = 1` in your `wrangler.toml / wrangler.json` file or via [the queues dashboard](https://dash.cloudflare.com/?to=/:account/queues).
**To opt-out, or to configure a fixed maximum concurrency**, set `max_concurrency = 1` in your [Wrangler configuration file](/workers/wrangler/configuration/) or via [the queues dashboard](https://dash.cloudflare.com/?to=/:account/queues).
**To opt-in, you do not need to take any action**: your consumer will begin to scale out as needed to keep up with your message backlog. It will scale back down as the backlog shrinks, and/or if a consumer starts to generate a higher rate of errors. To learn more about how consumers scale, refer to the [consumer concurrency](/queues/configuration/consumer-concurrency/) documentation.
- publish_date: "2023-03-02"
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/agents/capabilities/mcp-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ This converts your Cloudflare Worker into an MCP server, enabling interactions w


### 5. Deploy the MCP Server
Update your wrangler.toml with the appropriate configuration then deploy your Worker:
Update your [Wrangler configuration file](/workers/wrangler/configuration/) with the appropriate configuration then deploy your Worker:
```bash
wrangler deploy
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Running `npm create cloudflare@latest` will prompt you to install the create-clo
This will create a new `hello-ai` directory. Your new `hello-ai` directory will include:

- A "Hello World" Worker at `src/index.ts`.
- A `wrangler.json` configuration file.
- A [Wrangler configuration file](/workers/wrangler/configuration/)

Go to your application directory:

Expand All @@ -47,7 +47,7 @@ cd hello-ai

You must create an AI binding for your Worker to connect to Workers AI. Bindings allow your Workers to interact with resources, like Workers AI, on the Cloudflare Developer Platform.

To bind Workers AI to your Worker, add the following to the end of your `wrangler.json` file:
To bind Workers AI to your Worker, add the following to the end of your [Wrangler configuration file](/workers/wrangler/configuration/):

<WranglerConfig>

Expand All @@ -70,7 +70,7 @@ Update the `index.ts` file in your `hello-ai` application directory with the fol

```typescript title="src/index.ts" {78-81}
export interface Env {
// If you set another name in the `wrangler.toml / wrangler.json` file as the value for 'binding',
// If you set another name in the [Wrangler configuration file](/workers/wrangler/configuration/) as the value for 'binding',
// replace "AI" with the variable name you defined.
AI: Ai;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ This guide provides an overview of how to use the latest Cloudflare Workers AI G

## Prerequisites

- Ensure your Worker project is configured with an AI Gateway binding in `wrangler.json`.
- Install and use the `@cloudflare/workers-types` library, version `4.20250124.3` or above.

## 1. Add an AI Binding to your Worker

To connect your Worker to Workers AI, add the following to your `wrangler.toml` file:
To connect your Worker to Workers AI, add the following to your [Wrangler configuration file](/workers/wrangler/configuration/):

import { WranglerConfig } from "~/components";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { DirectoryListing, WranglerConfig } from "~/components"

## 1. Name your dataset and add it to your Worker

Add the following to your `wrangler.toml / wrangler.json` file to create a [binding](/workers/runtime-apis/bindings/) to a Workers Analytics Engine dataset. A dataset is like a table in SQL: the rows and columns should have consistent meaning.
Add the following to your [Wrangler configuration file](/workers/wrangler/configuration/) to create a [binding](/workers/runtime-apis/bindings/) to a Workers Analytics Engine dataset. A dataset is like a table in SQL: the rows and columns should have consistent meaning.

<WranglerConfig>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The following is a sample Worker which executes a query against a dataset of wea

First the environment variables are set up with the account ID and API token.

The account ID is set in the `wrangler.toml / wrangler.json` file:
The account ID is set in the [Wrangler configuration file](/workers/wrangler/configuration/):

<WranglerConfig>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ After running the `list` command, you will see all bucket names, including the o

## 5. Configure your Wrangler configuration file

Configure your `browser-worker` project's [`wrangler.toml / wrangler.json` file](/workers/wrangler/configuration/) by adding a browser [binding](/workers/runtime-apis/bindings/) and a [Node.js compatibility flag](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag). Browser bindings allow for communication between a Worker and a headless browser which allows you to do actions such as taking a screenshot, generating a PDF and more.
Configure your `browser-worker` project's [Wrangler configuration file](/workers/wrangler/configuration/) by adding a browser [binding](/workers/runtime-apis/bindings/) and a [Node.js compatibility flag](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag). Browser bindings allow for communication between a Worker and a headless browser which allows you to do actions such as taking a screenshot, generating a PDF and more.

Update your `wrangler.toml / wrangler.json` file with the Browser Rendering API binding, the R2 bucket you created and a Durable Object:
Update your Wrangler configuration file with the Browser Rendering API binding, the R2 bucket you created and a Durable Object:

<WranglerConfig>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ In your `browser-worker` directory, install Cloudflare's [fork of Puppeteer](/br
npm install @cloudflare/puppeteer --save-dev
```

## 3. Configure the `wrangler.toml / wrangler.json` file
## 3. Configure the [Wrangler configuration file](/workers/wrangler/configuration/)

<WranglerConfig>
```toml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ npx wrangler kv:namespace create BROWSER_KV_DEMO --preview

Take note of the IDs for the next step.

## 4. Configure the `wrangler.toml / wrangler.json` file
## 4. Configure the Wrangler configuration file

Configure your `browser-worker` project's [`wrangler.toml / wrangler.json` file](/workers/wrangler/configuration/) by adding a browser [binding](/workers/runtime-apis/bindings/) and a [Node.js compatibility flag](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag). Bindings allow your Workers to interact with resources on the Cloudflare developer platform. Your browser `binding` name is set by you, this guide uses the name `MYBROWSER`. Browser bindings allow for communication between a Worker and a headless browser which allows you to do actions such as taking a screenshot, generating a PDF and more.
Configure your `browser-worker` project's [Wrangler configuration file](/workers/wrangler/configuration/) by adding a browser [binding](/workers/runtime-apis/bindings/) and a [Node.js compatibility flag](/workers/configuration/compatibility-flags/#nodejs-compatibility-flag). Bindings allow your Workers to interact with resources on the Cloudflare developer platform. Your browser `binding` name is set by you, this guide uses the name `MYBROWSER`. Browser bindings allow for communication between a Worker and a headless browser which allows you to do actions such as taking a screenshot, generating a PDF and more.

Update your `wrangler.toml / wrangler.json` file with the Browser Rendering API binding and the KV namespaces you created:
Update your [Wrangler configuration file](/workers/wrangler/configuration/) with the Browser Rendering API binding and the KV namespaces you created:

<WranglerConfig>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Outbound Workers can be used to:
To use Outbound Workers:

1. Create a Worker intended to serve as your Outbound Worker.
2. Outbound Worker can be specified as an optional parameter in the [dispatch namespaces](/cloudflare-for-platforms/workers-for-platforms/get-started/configuration/#2-create-a-dispatch-namespace) binding in a project's [wrangler.toml](/workers/wrangler/configuration/). Optionally, to pass data from your dynamic dispatch Worker to the Outbound Worker, the variable names can be specified under **parameters**.
2. Outbound Worker can be specified as an optional parameter in the [dispatch namespaces](/cloudflare-for-platforms/workers-for-platforms/get-started/configuration/#2-create-a-dispatch-namespace) binding in a project's [Wrangler configuration file](/workers/wrangler/configuration/). Optionally, to pass data from your dynamic dispatch Worker to the Outbound Worker, the variable names can be specified under **parameters**.

Make sure that you have `[email protected]` or later [installed](/workers/wrangler/install-and-update/).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ Once this PUT request succeeds, the files are served on the User Worker. Request

If you prefer a CLI-based approach and your platform setup allows direct publishing, you can use Wrangler to deploy both your Worker code and static assets. Wrangler bundles and uploads static assets (from a specified directory) along with your Worker script, so you can manage everything in one place.

Create or update your `wrangler.toml` to specify where Wrangler should look for static files:
Create or update your [Wrangler configuration file](/workers/wrangler/configuration/) to specify where Wrangler should look for static files:

import { WranglerConfig } from "~/components";

<WranglerConfig>

```toml
name = "my-static-site"
Expand All @@ -230,6 +234,8 @@ directory = "./public"
binding = "ASSETS"
```

</WranglerConfig>

* `directory`: The local folder containing your static files (for example, `./public`).
* `binding`: The binding name used to reference these assets within your Worker code.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ You can set up External Evaluation rules using any API service, but to get start
id = "YOUR_KV_NAMESPACE_ID"
```

4. Open the `wrangler.toml / wrangler.json` file in an editor and insert the following:
4. Open the [Wrangler configuration file](/workers/wrangler/configuration/) in an editor and insert the following:

- `[[kv_namespaces]]`: Add the output generated in the previous step.
- `<TEAM_NAME>`: your Cloudflare Zero Trust <GlossaryTooltip term="team name">team name</GlossaryTooltip>.
Expand Down Expand Up @@ -139,7 +139,7 @@ To debug your External Evaluation rule:
cd my-worker
```

2. Open the `wrangler.toml / wrangler.json` file in an editor and set the `debug` variable to `TRUE`.
2. Open the [Wrangler configuration file](/workers/wrangler/configuration/) in an editor and set the `debug` variable to `TRUE`.

3. Deploy your changes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ To get started quickly, deploy our example Cloudflare Workers script by followin
cd risky-users
```

3. Modify the `wrangler.toml / wrangler.json` file to include the following values:
3. Modify the [Wrangler configuration file](/workers/wrangler/configuration/) to include the following values:

- `<ACCOUNT_ID>`: your Cloudflare [account ID](/fundamentals/setup/find-account-and-zone-ids/).
- `<TENANT_ID>`: your Entra ID **Directory (tenant) ID**, obtained when [setting up Entra ID as an identity provider](#1-set-up-entra-id-as-an-identity-provider).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Below is an example of a user identity that includes the `disk_encryption` and `

## 3. Route the Worker to your application

In the `wrangler.toml / wrangler.json` file, [set up a route](/workers/configuration/routing/routes/) that maps the Worker to your Access application domain:
In the [Wrangler configuration file](/workers/wrangler/configuration/), [set up a route](/workers/configuration/routing/routes/) that maps the Worker to your Access application domain:

<WranglerConfig>

Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/d1/best-practices/local-development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ To start a local development session:
[b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit
```

In this example, the Worker has access to local-only D1 database. The corresponding D1 binding in your `wrangler.toml / wrangler.json` file would resemble the following:
In this example, the Worker has access to local-only D1 database. The corresponding D1 binding in your [Wrangler configuration file](/workers/wrangler/configuration/) would resemble the following:

<WranglerConfig>

Expand All @@ -73,14 +73,14 @@ Refer to the [`wrangler dev` documentation](/workers/wrangler/commands/#dev) to

## Develop locally with Pages

You can only develop against a _local_ D1 database when using [Cloudflare Pages](/pages/) by creating a minimal `wrangler.toml / wrangler.json` file in the root of your Pages project. This can be useful when creating schemas, seeding data or otherwise managing a D1 database directly, without adding to your application logic.
You can only develop against a _local_ D1 database when using [Cloudflare Pages](/pages/) by creating a minimal [Wrangler configuration file](/workers/wrangler/configuration/) in the root of your Pages project. This can be useful when creating schemas, seeding data or otherwise managing a D1 database directly, without adding to your application logic.

:::caution[Local development for remote databases]

It is currently not possible to develop against a _remote_ D1 database when using [Cloudflare Pages](/pages/).
:::

your `wrangler.toml / wrangler.json` file should resemble the following:
Your [Wrangler configuration file](/workers/wrangler/configuration/) should resemble the following:

<WranglerConfig>

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/d1/configuration/environments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ In the code above, the `staging` environment is using a different database (`DAT

## Anatomy of Wrangler file

If you need to specify different D1 databases for different environments, your `wrangler.toml / wrangler.json` file may contain bindings that resemble the following:
If you need to specify different D1 databases for different environments, your [Wrangler configuration file](/workers/wrangler/configuration/) may contain bindings that resemble the following:

<WranglerConfig>

Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/d1/examples/d1-and-hono.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Hono is a fast web framework for building API-first applications, and it include

When using Workers:

* Ensure you have configured your [`wrangler.toml / wrangler.json` file](/d1/get-started/#3-bind-your-worker-to-your-d1-database) to bind your D1 database to your Worker.
* Ensure you have configured your [Wrangler configuration file](/d1/get-started/#3-bind-your-worker-to-your-d1-database) to bind your D1 database to your Worker.
* You can access your D1 databases via Hono's [`Context`](https://hono.dev/api/context) parameter: [bindings](https://hono.dev/getting-started/cloudflare-workers#bindings) are exposed on `context.env`. If you configured a [binding](/pages/functions/bindings/#d1-databases) named `DB`, then you would access [D1 Workers Binding API](/d1/worker-api/prepared-statements/) methods via `c.env.DB`.
* Refer to the Hono documentation for [Cloudflare Workers](https://hono.dev/getting-started/cloudflare-workers).

If you are using [Pages Functions](/pages/functions/):

1. Bind a D1 database to your [Pages Function](/pages/functions/bindings/#d1-databases).
2. Pass the `--d1 BINDING_NAME=DATABASE_ID` flag to `wrangler dev` when developing locally. `BINDING_NAME` should match what call in your code, and `DATABASE_ID` should match the `database_id` defined in your `wrangler.toml / wrangler.json` file: for example, `--d1 DB=xxxx-xxxx-xxxx-xxxx-xxxx`.
2. Pass the `--d1 BINDING_NAME=DATABASE_ID` flag to `wrangler dev` when developing locally. `BINDING_NAME` should match what call in your code, and `DATABASE_ID` should match the `database_id` defined in your Wrangler configuration file: for example, `--d1 DB=xxxx-xxxx-xxxx-xxxx-xxxx`.
3. Refer to the Hono guide for [Cloudflare Pages](https://hono.dev/getting-started/cloudflare-pages).

The following examples show how to access a D1 database bound to `DB` from both a Workers script and a Pages Function:
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/d1/examples/d1-and-remix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To set up a new Remix site on Cloudflare Pages that can query D1:

1. **Refer to [the Remix guide](/pages/framework-guides/deploy-a-remix-site/)**.
2. Bind a D1 database to your [Pages Function](/pages/functions/bindings/#d1-databases).
3. Pass the `--d1 BINDING_NAME=DATABASE_ID` flag to `wrangler dev` when developing locally. `BINDING_NAME` should match what call in your code, and `DATABASE_ID` should match the `database_id` defined in your `wrangler.toml / wrangler.json` file: for example, `--d1 DB=xxxx-xxxx-xxxx-xxxx-xxxx`.
3. Pass the `--d1 BINDING_NAME=DATABASE_ID` flag to `wrangler dev` when developing locally. `BINDING_NAME` should match what call in your code, and `DATABASE_ID` should match the `database_id` defined in your [Wrangler configuration file](/workers/wrangler/configuration/): for example, `--d1 DB=xxxx-xxxx-xxxx-xxxx-xxxx`.

The following example shows you how to define a Remix [`loader`](https://remix.run/docs/en/main/route/loader) that has a binding to a D1 database.

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/d1/examples/d1-and-sveltekit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To set up a new SvelteKit site on Cloudflare Pages that can query D1:
1. **Refer to [the SvelteKit guide](/pages/framework-guides/deploy-a-svelte-kit-site/) and Svelte's [Cloudflare adapter](https://kit.svelte.dev/docs/adapter-cloudflare)**.
2. Install the Cloudflare adapter within your SvelteKit project: `npm i -D @sveltejs/adapter-cloudflare`.
3. Bind a D1 database [to your Pages Function](/pages/functions/bindings/#d1-databases).
4. Pass the `--d1 BINDING_NAME=DATABASE_ID` flag to `wrangler dev` when developing locally. `BINDING_NAME` should match what call in your code, and `DATABASE_ID` should match the `database_id` defined in your `wrangler.toml / wrangler.json` file: for example, `--d1 DB=xxxx-xxxx-xxxx-xxxx-xxxx`.
4. Pass the `--d1 BINDING_NAME=DATABASE_ID` flag to `wrangler dev` when developing locally. `BINDING_NAME` should match what call in your code, and `DATABASE_ID` should match the `database_id` defined in your [Wrangler configuration file](/workers/wrangler/configuration/): for example, `--d1 DB=xxxx-xxxx-xxxx-xxxx-xxxx`.

The following example shows you how to create a server endpoint configured to query D1.

Expand Down
Loading

0 comments on commit 98fcddb

Please sign in to comment.