From 8a76065b3403f9e45b92bc5c2f2489c559082c53 Mon Sep 17 00:00:00 2001 From: Edmund Hung Date: Mon, 15 Sep 2025 17:44:42 +0100 Subject: [PATCH] rename hyperdrive local connection string variable name --- .../hyperdrive/configuration/local-development.mdx | 12 ++++++------ src/content/docs/pages/functions/bindings.mdx | 2 +- .../wrangler/system-environment-variables.mdx | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/content/docs/hyperdrive/configuration/local-development.mdx b/src/content/docs/hyperdrive/configuration/local-development.mdx index 68764750a97f226..ef7d2173f5a01bc 100644 --- a/src/content/docs/hyperdrive/configuration/local-development.mdx +++ b/src/content/docs/hyperdrive/configuration/local-development.mdx @@ -21,16 +21,16 @@ You can also connect to a remote database for remote development using the `npx To specify a database to connect to when developing locally, you can: -- **Recommended:** Create a `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_` [environmental variable](/workers/configuration/environment-variables/) with the connection string of your database. `` is the name of the binding assigned to your Hyperdrive in your [Wrangler configuration file](/workers/wrangler/configuration/) or Pages configuration. This allows you to avoid committing potentially sensitive credentials to source control in your Wrangler configuration file, if your test/development database is not ephemeral. If you have configured multiple Hyperdrive bindings, replace `` with the unique binding name for each. +- **Recommended:** Create a `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_` [environmental variable](/workers/configuration/environment-variables/) with the connection string of your database. `` is the name of the binding assigned to your Hyperdrive in your [Wrangler configuration file](/workers/wrangler/configuration/) or Pages configuration. This allows you to avoid committing potentially sensitive credentials to source control in your Wrangler configuration file, if your test/development database is not ephemeral. If you have configured multiple Hyperdrive bindings, replace `` with the unique binding name for each. - Set `localConnectionString` in the Wrangler configuration file. -If both the `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_` [environmental variable](/workers/configuration/environment-variables/) and `localConnectionString` in the Wrangler configuration file are set, `wrangler dev` will use the environmental variable instead. Use `unset WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_` to unset any existing environmental variables. +If both the `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_` [environmental variable](/workers/configuration/environment-variables/) and `localConnectionString` in the Wrangler configuration file are set, `wrangler dev` will use the environmental variable instead. Use `unset CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_` to unset any existing environmental variables. For example, to use the environmental variable, export the environmental variable before running `wrangler dev`: ```sh # Your configured Hyperdrive binding is "TEST_DB" -export WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_TEST_DB="postgres://user:password@localhost:5432/databasename" +export CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_TEST_DB="postgres://user:password@localhost:5432/databasename" # Start a local development session referencing this local instance npx wrangler dev ``` @@ -50,7 +50,7 @@ localConnectionString = "postgres://user:password@localhost:5432/databasename" ## Use `wrangler dev` -The following example shows you how to check your wrangler version, set a `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_TEST_DB` [environmental variable](/workers/configuration/environment-variables/), and run a `wrangler dev` session: +The following example shows you how to check your wrangler version, set a `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_TEST_DB` [environmental variable](/workers/configuration/environment-variables/), and run a `wrangler dev` session: ```sh # Confirm you are using wrangler v3.0+ @@ -63,7 +63,7 @@ npx wrangler --version ```sh # Set your environmental variable: your configured Hyperdrive binding is "TEST_DB". -export WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_TEST_DB="postgres://user:password@localhost:5432/databasename" +export CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_TEST_DB="postgres://user:password@localhost:5432/databasename" ``` ```sh @@ -73,7 +73,7 @@ npx wrangler dev ```sh output ------------------ -Found a non-empty WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_TEST_DB variable. Hyperdrive will connect to this database +Found a non-empty CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_TEST_DB variable. Hyperdrive will connect to this database during local development. wrangler dev now uses local mode by default, powered by 🔥 Miniflare and 👷 workerd. diff --git a/src/content/docs/pages/functions/bindings.mdx b/src/content/docs/pages/functions/bindings.mdx index 3fc677cfe0dd0db..5811d22ec506c73 100644 --- a/src/content/docs/pages/functions/bindings.mdx +++ b/src/content/docs/pages/functions/bindings.mdx @@ -713,7 +713,7 @@ export const onRequest: PagesFunction = async (context) => { ### Interact with your Hyperdrive binding locally -To interact with your Hyperdrive binding locally, you must provide a local connection string to your database that your Pages project will connect to directly. You can set an environment variable `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_` with the connection string of the database, or use the Wrangler file to configure your Hyperdrive binding with a `localConnectionString` as specified in [Hyperdrive documentation for local development](/hyperdrive/configuration/local-development/). Then, run [`npx wrangler pages dev `](/workers/wrangler/commands/#dev-1). +To interact with your Hyperdrive binding locally, you must provide a local connection string to your database that your Pages project will connect to directly. You can set an environment variable `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_` with the connection string of the database, or use the Wrangler file to configure your Hyperdrive binding with a `localConnectionString` as specified in [Hyperdrive documentation for local development](/hyperdrive/configuration/local-development/). Then, run [`npx wrangler pages dev `](/workers/wrangler/commands/#dev-1). ## Analytics Engine diff --git a/src/content/docs/workers/wrangler/system-environment-variables.mdx b/src/content/docs/workers/wrangler/system-environment-variables.mdx index d24c93dacafc7c0..2feda7959301c11 100644 --- a/src/content/docs/workers/wrangler/system-environment-variables.mdx +++ b/src/content/docs/workers/wrangler/system-environment-variables.mdx @@ -55,9 +55,9 @@ Wrangler supports the following environment variables: - 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). -- `WRANGLER_HYPERDRIVE_LOCAL_CONNECTION_STRING_` +- `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_` - - 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:password@127.0.0.1:5432/testdb"`. Each Hyperdrive is uniquely distinguished by the binding name. + - 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 `CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_PROD_DB="postgres://user:password@127.0.0.1:5432/testdb"`. Each Hyperdrive is uniquely distinguished by the binding name. - `CLOUDFLARE_API_BASE_URL`