hey y'all - wanted to talk about the `localConnectionString` in `wrangler.toml` with Hyperdrive I'v

hey y'all - wanted to talk about the localConnectionString in
wrangler.toml
with Hyperdrive

I've seen a couple other messages in here saying people didn't think it should be stored in plain text like this/might contain secrets (password/endpoint)/etc., and at least for my use case, I agree.

I believe the intention on CF's side is that this shouldn't ever be a string that has secrets + you should only point to a local Postgres instance (IE so it'd be postgres://localhost, or something that's fine to commit to VCS), but there's definitely been times where I need to connect to a remote dev database. For example, AWS Aurora-exclusive features that don't have a local equivalent/emulator.

The current model doesn't seem to support this very well, as you're forced to either put the sensitive string in
wrangler.toml
or make something akin to a OVERRIDE_DB_CONNECTION_STRING env var, and handle choosing between hyperdrive.connectionString or the override in your app. Even if you do make an env var/some other way to sidestep the builtin solution, wrangler still requires a localConnectionString to be set in
wrangler.toml
.

Is there any chance of a better way to do handle this / am I missing something to make local dev easier?
Was this page helpful?