Skip to main content

Module hyperdrive

Module hyperdrive 

Source
Expand description

#3319: the Hyperdrive settings of bynk.toml.

Two tables name a Postgres capability (capability Main = Postgres) and say where its connection string comes from. Neither holds a connection string: a string is a secret, and bynk.toml is committed. Each names an environment variable to read it from.

# Deploy: `bynk deploy` makes or updates the Hyperdrive config from the
# variable, or adopts a config that already exists (no string needed).
[deploy.hyperdrive.Main]
connection_env = "MAIN_DATABASE_URL"
config_id = { production = "0123…" }

# Development: `bynk dev` hands the variable's value to `wrangler dev`.
[dev.hyperdrive.Main]
connection_env = "MAIN_LOCAL_DATABASE_URL"

Structs§

HyperdriveDeploy
One capability’s [deploy.hyperdrive.<Capability>] entry.

Constants§

DEPLOY_ENTRY_KEYS
The keys of a [deploy.hyperdrive.<Capability>] entry.
DEV_ENTRY_KEYS
The keys of a [dev.hyperdrive.<Capability>] entry.

Functions§

deploy_hyperdrive_from
The [deploy] table’s hyperdrive entries.
dev_hyperdrive_from
The [dev] table’s hyperdrive entries.
is_config_id
Whether id is shaped like a Hyperdrive config id: 32 hexadecimal characters. It goes into an authenticated API path, so nothing else (a /, ? or ..) may reach it.
is_env_var_name
Whether name can be an environment variable’s name: a letter or _, then letters, digits and _. A value that is not (postgres://…) is a connection string written where a variable’s name belongs, which the reader refuses without ever echoing it.
try_read_hyperdrive_deploy
try_read_hyperdrive_deploy_with, reading bynk.toml from disk.
try_read_hyperdrive_deploy_with
Read bynk.toml’s [deploy.hyperdrive] entries, honouring overlay. No manifest, or none of the table, is empty.
try_read_hyperdrive_dev
try_read_hyperdrive_dev_with, reading bynk.toml from disk.
try_read_hyperdrive_dev_with
Read bynk.toml’s [dev.hyperdrive] entries, honouring overlay.

Type Aliases§

HyperdriveDeployConfig
The [deploy.hyperdrive] entries, by capability name.
HyperdriveDevConfig
The [dev.hyperdrive] entries, by capability name: the environment variable bynk dev reads each connection string from.