diff --git a/src/content/docs/hyperdrive/get-started.mdx b/src/content/docs/hyperdrive/get-started.mdx index d16b4eda708978e..53f247ecb922e34 100644 --- a/src/content/docs/hyperdrive/get-started.mdx +++ b/src/content/docs/hyperdrive/get-started.mdx @@ -129,18 +129,14 @@ If successful, the command will output your new Hyperdrive configuration: ```json { - "id": "", - "name": "YOUR_CONFIG_NAME", - "origin": { - "host": "YOUR_DATABASE_HOST", - "port": 5432, - "database": "DATABASE", - "user": "DATABASE_USER" - }, - "caching": { - "disabled": false - } + "hyperdrive": [ + { + "binding": "HYPERDRIVE", + "id": "" + } + ] } + ``` Copy the `id` field: you will use this in the next step to make Hyperdrive accessible from your Worker script. @@ -151,6 +147,7 @@ Hyperdrive will attempt to connect to your database with the provided credential ::: + ## 4. Bind your Worker to Hyperdrive diff --git a/src/content/partials/hyperdrive/create-hyperdrive-binding.mdx b/src/content/partials/hyperdrive/create-hyperdrive-binding.mdx index 7dd4b922bb6bf2f..980827207f1a11c 100644 --- a/src/content/partials/hyperdrive/create-hyperdrive-binding.mdx +++ b/src/content/partials/hyperdrive/create-hyperdrive-binding.mdx @@ -24,3 +24,24 @@ Specifically: - The value (string) you set for the `name` (binding name) will be used to reference this database in your Worker. In this tutorial, name your binding `HYPERDRIVE`. - The binding must be [a valid JavaScript variable name](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#variables). For example, `binding = "hyperdrive"` or `binding = "productionDB"` would both be valid names for the binding. - Your binding is available in your Worker at `env.`. + + +If you wish to use a local database during development, you can add a `localConnectionString` to your Hyperdrive configuration with the connection string of your database: + + + + +```toml +[[hyperdrive]] +binding = "HYPERDRIVE" +id = "" # the ID associated with the Hyperdrive you just created +localConnectionString = "" +``` + + + +:::note + +Learn more about setting up [Hyperdrive for local development](/hyperdrive/configuration/local-development/). + +::: \ No newline at end of file