Shifting to workers from pages
We're looking into workers as an alternative to pages, and have a couple of compatibility questions - /
1. We have prod/preview env settings in pages, i cannot find the equivalent settings on workers. How do i set different env variables/secrets in prod/preview workers?
2. We get branch preview urls on pages, but for workers, it seems to change per commit. Is there a way to have a common branch deployment url for workers?
1 Reply
Hey @zilch great questions! Here are some answers:
- We unfortunately don't have prod/preview env settings in Workers today that match what you get in Pages. We are actively working on this though, but it is a gap currently. You can set up environmnets in your Wrangler configuration, but these basically just create new Workers with different prefixes: https://developers.cloudflare.com/workers/configuration/environment-variables/#configuring-different-environments-in-wrangler
- We are actively working on stable branch preview URLs, and hope to get them out soon! Will keep you updated on progress
Cloudflare Docs
Environment variables · Cloudflare Workers docs
Environment variables are a type of binding that allow you to attach text strings or JSON values to your Worker