Problem with "environment variables managed through wrangler.toml" and disabling that behavior

I have a "staging" deployment of my site and a "production" deployment. Both have different configuration. I set this up as two different pages deployments, since you cannot do this in a single deployment. However, I need them to be configured differently (i.e. talk to staging vs. production APIs). I cannot have two different wrangler.tomls, so I need to manage each deployment in the dashboard. This is a problem since one of the pages deployments (production) is already in heavy use. I removed wrangler.toml, but the dashboard still think wrangler.toml manages the variables. Is this something that can be re-disabled from your side? Do I need to create a new production deployment? Thanks!
2 Replies
Walshy
Walshy6mo ago
you can use environments in wrangler.toml fwiw
[env.production]
[env.production.vars]
API_URL = "production.url"

[env.preview]
[env.preview.vars]
API_URL = "staging.url"
[env.production]
[env.production.vars]
API_URL = "production.url"

[env.preview]
[env.preview.vars]
API_URL = "staging.url"
cole
coleOP6mo ago
Yeah, problem is just that when using pages deployment, I can't "choose" an environment. Both pages endpoints use the prod/preview dichotomy.

Did you find this page helpful?