-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Misleading Cloudflare environment variables section #13897
Copy link
Copy link
Open
Labels
help - confirm behaviourWalk through the example/issue and confirm this is a general behaviour, or a correct update to make.Walk through the example/issue and confirm this is a general behaviour, or a correct update to make.improve or update documentationEnhance / update existing documentation (e.g. add example, improve description, update for changes)Enhance / update existing documentation (e.g. add example, improve description, update for changes)
Metadata
Metadata
Assignees
Labels
help - confirm behaviourWalk through the example/issue and confirm this is a general behaviour, or a correct update to make.Walk through the example/issue and confirm this is a general behaviour, or a correct update to make.improve or update documentationEnhance / update existing documentation (e.g. add example, improve description, update for changes)Enhance / update existing documentation (e.g. add example, improve description, update for changes)
Type
Fields
Give feedbackNo fields configured for issues without a type.
📚 Subject area/topic
Cloudflare Environment Variables
📋 Page(s) affected (or suggested, for new content)
Page: https://docs.astro.build/en/guides/integrations-guide/cloudflare/#environment-variables-and-bindings
Filepath: src/content/docs/en/guides/integrations-guide/cloudflare.mdx
📋 Description of content that is out-of-date or incorrect
Background
When using the Cloudflare adapter, I've learned I can use environment variables in 4 ways.
import.meta.env.*process.env.*From my understanding, the first two are Astro's type-safe system and second two are Cloudflare's (also type-safe) system.
The Confusing Part
In the cloudflare adapter guide, the sentence "They are also compatible with the astro:env API" is unclear.
Cloudflare environment variables defined in
.dev.vars,wrangler.jsoncor the cloudflare dashboard can NOT be imported from astro:env/server.Is the documentation only suggesting that I can use both environment variable systems in the same application? Or is it that the APIs are connected and can be mixed? It should be clearly stated that these two systems are separate and when either is preferable.