Skip to content

Commit 1cf878b

Browse files
committed
thomasgauvin WIP separate wrangler docs
1 parent 9d833a4 commit 1cf878b

28 files changed

+324
-296
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
type: example
3+
summary: Connect Hyperdrive to a Prisma Postgres database.
4+
pcx_content_type: example
5+
title: Connect to Prisma Postgres
6+
sidebar:
7+
order: 9
8+
description: Connect Hyperdrive to a Prisma Postgres database.
9+
---
10+
11+
import { Render } from "~/components";
12+
13+
This example shows you how to connect Hyperdrive to a [Prisma](https://www.prisma.io/postgres) Postgres database. Prisma Postgres provides global-first and serverless-ready Postgres databases.
14+
15+
## 1. Allow Hyperdrive access
16+
17+
You can connect Hyperdrive to any existing pgEdge database with the default user and password provided by pgEdge.
18+
19+
### pgEdge dashboard
20+
21+
To retrieve your connection string from the pgEdge dashboard:
22+
23+
1. Go to the [**pgEdge dashboard**](https://app.pgedge.com) and select the database you wish to connect to.
24+
2. From the **Connect to your database** section, note down the connection string (starting with `postgres://app@...`) from the **Connection String** text box.
25+
26+
## 2. Create a database configuration
27+
28+
<Render file="create-hyperdrive-config" />

src/content/docs/workers/wrangler/api.mdx renamed to src/content/docs/wrangler/api.mdx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
---
22
pcx_content_type: configuration
3-
title: API
3+
title: Programmatic execution
44
sidebar:
5-
order: 2
5+
order: 4
66
head: []
77
description: A set of programmatic APIs that can be integrated with local
88
Cloudflare Workers-related workflows.
99
---
1010

11-
import { Render, TabItem, Tabs, Type, MetaInfo, WranglerConfig } from "~/components";
11+
import {
12+
Render,
13+
TabItem,
14+
Tabs,
15+
Type,
16+
MetaInfo,
17+
WranglerConfig,
18+
} from "~/components";
19+
20+
Programmatic execution can be useful to automate testing of Workers projects in continuous testing environments. In these scenarios, you need a way
21+
to access the underlying server, emulations or bindings of Cloudflare Workers which are usually present when developing with the Wrangler CLI.
1222

1323
Wrangler offers APIs to programmatically interact with your Cloudflare Workers.
1424

@@ -340,8 +350,6 @@ The bindings supported by `getPlatformProxy` are:
340350

341351
For example, you might have the following file read by `getPlatformProxy`.
342352

343-
344-
345353
<WranglerConfig>
346354

347355
```toml

src/content/docs/workers/wrangler/bundling.mdx renamed to src/content/docs/wrangler/builds/bundling.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ pcx_content_type: configuration
33
title: Bundling
44
head: []
55
description: Review Wrangler's default bundling.
6+
sidebar:
7+
order: 2
68
---
79

810
By default, Wrangler bundles your Worker code using [`esbuild`](https://esbuild.github.io/). This means that Wrangler has built-in support for importing modules from [npm](https://www.npmjs.com/) defined in your `package.json`. To review the exact code that Wrangler will upload to Cloudflare, run `npx wrangler deploy --dry-run --outdir dist`, which will show your Worker code after Wrangler's bundling.

src/content/docs/workers/wrangler/custom-builds.mdx renamed to src/content/docs/wrangler/builds/custom-builds.mdx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ pcx_content_type: configuration
33
title: Custom builds
44
head: []
55
description: Customize how your code is compiled, before being processed by Wrangler.
6-
6+
sidebar:
7+
order: 1
78
---
89

9-
import { Render, Type, MetaInfo, WranglerConfig } from "~/components"
10+
import { Render, Type, MetaInfo, WranglerConfig } from "~/components";
1011

1112
Custom builds are a way for you to customize how your code is compiled, before being processed by Wrangler.
1213

@@ -19,21 +20,17 @@ With the release of Wrangler v2, it is no longer necessary to use custom builds
1920

2021
Custom builds are configured by adding a `[build]` section in your `wrangler.toml / wrangler.json` file, and using the following options for configuring your custom build.
2122

23+
- `command` <Type text="string" /> <MetaInfo text="optional" />
2224

25+
- The command used to build your Worker. On Linux and macOS, the command is executed in the `sh` shell and the `cmd` shell for Windows. The `&&` and `||` shell operators may be used. This command will be run as part of `wrangler dev` and `npx wrangler deploy`.
2326

24-
* `command` <Type text="string" /> <MetaInfo text="optional" />
25-
26-
* The command used to build your Worker. On Linux and macOS, the command is executed in the `sh` shell and the `cmd` shell for Windows. The `&&` and `||` shell operators may be used. This command will be run as part of `wrangler dev` and `npx wrangler deploy`.
27-
28-
* `cwd` <Type text="string" /> <MetaInfo text="optional" />
29-
30-
* The directory in which the command is executed.
31-
32-
* `watch_dir` <Type text="string | string\[]" /> <MetaInfo text="optional" />
27+
- `cwd` <Type text="string" /> <MetaInfo text="optional" />
3328

34-
* The directory to watch for changes while using `wrangler dev`. Defaults to the current working directory.
29+
- The directory in which the command is executed.
3530

31+
- `watch_dir` <Type text="string | string\[]" /> <MetaInfo text="optional" />
3632

33+
- The directory to watch for changes while using `wrangler dev`. Defaults to the current working directory.
3734

3835
Example:
3936

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: Build outputs
3+
pcx_content_type: how-to
4+
head:
5+
- tag: title
6+
content: Build outputs
7+
sidebar:
8+
group:
9+
hideIndex: true
10+
order: 4
11+
description: Customize how your code is compiled or bundled by Wrangler.
12+
---
13+
14+
import { DirectoryListing } from "~/components";
15+
16+
<DirectoryListing />

src/content/docs/workers/wrangler/commands.mdx renamed to src/content/docs/wrangler/commands.mdx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
---
22
pcx_content_type: reference
3-
title: Commands
3+
title: CLI Commands
4+
sidebar:
5+
order: 2
46
head:
57
- tag: title
6-
content: Commands - Wrangler
8+
content: CLI Commands - Wrangler
79
description: Create, develop, and deploy your Cloudflare Workers with Wrangler commands.
810
---
911

10-
import { TabItem, Tabs, Render, Type, MetaInfo, WranglerConfig } from "~/components";
12+
import {
13+
TabItem,
14+
Tabs,
15+
Render,
16+
Type,
17+
MetaInfo,
18+
WranglerConfig,
19+
} from "~/components";
1120

1221
Wrangler offers a number of commands to manage your Cloudflare Workers.
1322

@@ -1841,6 +1850,7 @@ wrangler cert upload certificate-authority --ca-cert <PATH> [OPTIONS]
18411850
```
18421851

18431852
- `--ca-cert` <Type text="string" /> <MetaInfo text="required" />
1853+
18441854
- A path to the Certificate Authority (CA) chain certificate to upload.
18451855

18461856
- `--name` <Type text="string" /> <MetaInfo text="optional" />

src/content/docs/workers/wrangler/configuration.mdx renamed to src/content/docs/wrangler/configuration/configuration-file.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
pcx_content_type: configuration
3-
title: Configuration
3+
title: Configuration file
4+
sidebar:
5+
order: 1
46
head:
57
- tag: title
68
content: Configuration - Wrangler
@@ -412,7 +414,7 @@ watch_dir = "build_watch_dir"
412414

413415
You can impose limits on your Worker's behavior at runtime. Limits are only supported for the [Standard Usage Model](/workers/platform/pricing/#example-pricing-standard-usage-model). Limits are only enforced when deployed to Cloudflare's network, not in local development. The CPU limit can be set to a maximum of 30,000 milliseconds (30 seconds).
414416

415-
<Render file="isolate-cpu-flexibility" /> <br />
417+
<Render file="isolate-cpu-flexibility" product="workers" /> <br />
416418

417419
- `cpu_ms` <Type text="number" /> <MetaInfo text="optional" />
418420

@@ -631,8 +633,7 @@ deleted_classes = ["DeprecatedClass"] # Array of deleted class names
631633

632634
Example:
633635

634-
<Render file="envvar-example" />
635-
636+
<Render file="envvar-example" product="workers" />
636637
### Hyperdrive
637638

638639
[Hyperdrive](/hyperdrive/) bindings allow you to interact with and query any Postgres database from within a Worker.
@@ -1104,7 +1105,7 @@ local_protocol = "http"
11041105

11051106
[Secrets](/workers/configuration/secrets/) are a type of binding that allow you to [attach encrypted text values](/workers/wrangler/commands/#secret) to your Worker.
11061107

1107-
<Render file="secrets-in-dev" />
1108+
<Render file="secrets-in-dev" product="workers" />
11081109

11091110
## Module Aliasing
11101111

@@ -1198,7 +1199,7 @@ upload_source_maps = true
11981199

11991200
## Workers Sites
12001201

1201-
<Render file="workers_sites" />
1202+
<Render file="workers_sites" product="workers" />
12021203

12031204
[Workers Sites](/workers/configuration/sites/) allows you to host static websites, or dynamic websites using frameworks like Vue or React, on Workers.
12041205

src/content/docs/workers/wrangler/environments.mdx renamed to src/content/docs/wrangler/configuration/environments.mdx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ title: Environments
44
head: []
55
description: Deploy the same Worker application with different configuration for
66
each environment.
7+
sidebar:
8+
order: 3
79
---
810

911
import { WranglerConfig } from "~/components";
@@ -61,8 +63,6 @@ After you have configured your environment, run `npx wrangler deploy` in your Wo
6163

6264
Review the following example Wrangler file:
6365

64-
65-
6666
<WranglerConfig>
6767

6868
```toml
@@ -95,8 +95,6 @@ You may assign environment-specific [secrets](/workers/configuration/secrets/) b
9595

9696
The following Wrangler file adds two environments, `[env.staging]` and `[env.production]`, to the Wrangler file. If you are deploying to a [Custom Domain](/workers/configuration/routing/custom-domains/) or [route](/workers/configuration/routing/routes/), you must provide a [`route` or `routes` key](/workers/wrangler/configuration/) for each environment.
9797

98-
99-
10098
<WranglerConfig>
10199

102100
```toml
@@ -168,8 +166,6 @@ if (ENVIRONMENT === "staging") {
168166

169167
To deploy your code to your `*.workers.dev` subdomain, include `workers_dev = true` in the desired environment. Your Wrangler file may look like this:
170168

171-
172-
173169
<WranglerConfig>
174170

175171
```toml
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Configuration
3+
pcx_content_type: how-to
4+
head:
5+
- tag: title
6+
content: Configuration
7+
sidebar:
8+
group:
9+
hideIndex: true
10+
order: 3
11+
description: Configure Wrangler to customize the
12+
development and deployment setup for your Worker project and other Developer
13+
Platform products.
14+
---
15+
16+
import { DirectoryListing } from "~/components";
17+
18+
<DirectoryListing />

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

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ pcx_content_type: configuration
33
title: System environment variables
44
head: []
55
description: Local environment variables that can change Wrangler's behavior.
6-
6+
sidebar:
7+
order: 2
78
---
89

9-
import { Render, Type, MetaInfo } from "~/components"
10+
import { Render, Type, MetaInfo } from "~/components";
1011

1112
System environment variables are local environment variables that can change Wrangler's behavior. There are three ways to set system environment variables:
1213

@@ -25,47 +26,41 @@ To set different system environment variables for each environment, create files
2526

2627
Wrangler supports the following environment variables:
2728

29+
- `CLOUDFLARE_ACCOUNT_ID` <Type text="string" /> <MetaInfo text="optional" />
2830

31+
- The [account ID](/fundamentals/setup/find-account-and-zone-ids/) for the Workers related account.
2932

30-
* `CLOUDFLARE_ACCOUNT_ID` <Type text="string" /> <MetaInfo text="optional" />
31-
32-
* The [account ID](/fundamentals/setup/find-account-and-zone-ids/) for the Workers related account.
33-
34-
* `CLOUDFLARE_API_TOKEN` <Type text="string" /> <MetaInfo text="optional" />
35-
36-
* The [API token](/fundamentals/api/get-started/create-token/) for your Cloudflare account, can be used for authentication for situations like CI/CD, and other automation.
37-
38-
* `CLOUDFLARE_API_KEY` <Type text="string" /> <MetaInfo text="optional" />
39-
40-
* The API key for your Cloudflare account, usually used for older authentication method with `CLOUDFLARE_EMAIL=`.
41-
42-
* `CLOUDFLARE_EMAIL` <Type text="string" /> <MetaInfo text="optional" />
33+
- `CLOUDFLARE_API_TOKEN` <Type text="string" /> <MetaInfo text="optional" />
4334

44-
* The email address associated with your Cloudflare account, usually used for older authentication method with `CLOUDFLARE_API_KEY=`.
35+
- The [API token](/fundamentals/api/get-started/create-token/) for your Cloudflare account, can be used for authentication for situations like CI/CD, and other automation.
4536

46-
* `WRANGLER_SEND_METRICS` <Type text="string" /> <MetaInfo text="optional" />
37+
- `CLOUDFLARE_API_KEY` <Type text="string" /> <MetaInfo text="optional" />
4738

48-
* Options for this are `true` and `false`. Defaults to `true`. Controls whether Wrangler can send anonymous usage data to Cloudflare for this project. You can learn more about this in our [data policy](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler/telemetry.md).
39+
- The API key for your Cloudflare account, usually used for older authentication method with `CLOUDFLARE_EMAIL=`.
4940

50-
* `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_<BINDING_NAME>`<Type text="string" /> <MetaInfo text="optional" />
41+
- `CLOUDFLARE_EMAIL` <Type text="string" /> <MetaInfo text="optional" />
5142

52-
* The [local connection string](/hyperdrive/configuration/local-development/) for your database to use in local development with [Hyperdrive](/hyperdrive/). For example, if the binding for your Hyperdrive is named `PROD_DB`, this would be `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_PROD_DB="postgres://user:[email protected]:5432/testdb"`. Each Hyperdrive is uniquely distinguished by the binding name.
43+
- The email address associated with your Cloudflare account, usually used for older authentication method with `CLOUDFLARE_API_KEY=`.
5344

54-
* `CLOUDFLARE_API_BASE_URL` <Type text="string" /> <MetaInfo text="optional" />
45+
- `WRANGLER_SEND_METRICS` <Type text="string" /> <MetaInfo text="optional" />
5546

56-
* The default value is `"https://api.cloudflare.com/client/v4"`.
47+
- Options for this are `true` and `false`. Defaults to `true`. Controls whether Wrangler can send anonymous usage data to Cloudflare for this project. You can learn more about this in our [data policy](https://github.com/cloudflare/workers-sdk/tree/main/packages/wrangler/telemetry.md).
5748

58-
* `WRANGLER_LOG` <Type text="string" /> <MetaInfo text="optional" />
49+
- `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_<BINDING_NAME>`<Type text="string" /> <MetaInfo text="optional" />
5950

60-
* Options for Logging levels are `"none"`, `"error"`, `"warn"`, `"info"`, `"log"` and `"debug"`. Levels are case-insensitive and default to `"log"`. If an invalid level is specified, Wrangler will fallback to the default. Logs can include requests to Cloudflare's API, any usage data being collected, and more verbose error logs.
51+
- The [local connection string](/hyperdrive/configuration/local-development/) for your database to use in local development with [Hyperdrive](/hyperdrive/). For example, if the binding for your Hyperdrive is named `PROD_DB`, this would be `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_PROD_DB="postgres://user:[email protected]:5432/testdb"`. Each Hyperdrive is uniquely distinguished by the binding name.
6152

62-
* `FORCE_COLOR` <Type text="string" /> <MetaInfo text="optional" />
53+
- `CLOUDFLARE_API_BASE_URL` <Type text="string" /> <MetaInfo text="optional" />
6354

64-
* By setting this to `0`, you can disable Wrangler's colorised output, which makes it easier to read with some terminal setups. For example, `FORCE_COLOR=0`.
55+
- The default value is `"https://api.cloudflare.com/client/v4"`.
6556

57+
- `WRANGLER_LOG` <Type text="string" /> <MetaInfo text="optional" />
6658

59+
- Options for Logging levels are `"none"`, `"error"`, `"warn"`, `"info"`, `"log"` and `"debug"`. Levels are case-insensitive and default to `"log"`. If an invalid level is specified, Wrangler will fallback to the default. Logs can include requests to Cloudflare's API, any usage data being collected, and more verbose error logs.
6760

61+
- `FORCE_COLOR` <Type text="string" /> <MetaInfo text="optional" />
6862

63+
- By setting this to `0`, you can disable Wrangler's colorised output, which makes it easier to read with some terminal setups. For example, `FORCE_COLOR=0`.
6964

7065
## Example `.env` file
7166

@@ -84,8 +79,8 @@ WRANGLER_LOG=debug
8479

8580
The following variables are deprecated. Use the new variables listed above to prevent any issues or unwanted messaging.
8681

87-
* `CF_ACCOUNT_ID`
88-
* `CF_API_TOKEN`
89-
* `CF_API_KEY`
90-
* `CF_EMAIL`
91-
* `CF_API_BASE_URL`
82+
- `CF_ACCOUNT_ID`
83+
- `CF_API_TOKEN`
84+
- `CF_API_KEY`
85+
- `CF_EMAIL`
86+
- `CF_API_BASE_URL`

0 commit comments

Comments
 (0)