blackfish
blackfish
CDCloudflare Developers
Created by blackfish on 4/15/2025 in #workers-help
Best way to configure wrangler.toml for team D1 development with per-dev env vars
Question: I’m setting up a Cloudflare Worker with D1 for team development. Each developer will have their own Cloudflare account to deploy/test independently. Goal: - Developers should override local D1 configs (DB name, ID, etc.) via environment variables (e.g., .dev.vars). - Avoid hardcoding values in wrangler.toml. For example, something like this in wragler.toml
[env.local]
name = "" # read from env based on the dev config

[[env.local.d1_databases]]
binding = "DB"
database_name = "" # read from env based on the dev confg
database_id = "" # read from env based on the dev confg
[env.local]
name = "" # read from env based on the dev config

[[env.local.d1_databases]]
binding = "DB"
database_name = "" # read from env based on the dev confg
database_id = "" # read from env based on the dev confg
Is there any way to achieve this or any other alternatives?
1 replies