[miniflare] Add environment variables to control cf.json fetching#12469
[miniflare] Add environment variables to control cf.json fetching#12469petebacondarwin merged 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 814d321 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Claude finished @petebacondarwin's task —— View job Changeset Review
✅ All changesets look good The changeset
The changeset follows best practices with a clear title, detailed explanation of the new environment variables, and practical examples showing real-world usage scenarios. |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
9abc10d to
9a9e66d
Compare
NuroDev
left a comment
There was a problem hiding this comment.
Overall looks good. One question though:
Explicit cf option in Miniflare: Takes precedence over the environment variable.
Is this normal? I have always assumed that if an environment variable exists to modify how a feature functions that that will always be the highest level of override, no? The same as if there is an experimental feature hard coded to now be enabled by default and there was an env var to disable it, enabling / using that env var would disable it and override the hard coded default.
I think we normally go with: CLI arg -> env var -> config file -> default In this case the "explicit cf option" is part of the Miniflare programmatic API, which I think equates to the CLI args when in programmatic usage. |
9a9e66d to
aba7873
Compare
aba7873 to
3f613d6
Compare
|
@NuroDev - implementation changed PTAL |
…ironment variables Add documentation for two new environment variables that control cf.json fetching behavior in Miniflare: - CLOUDFLARE_CF_FETCH_ENABLED: disable cf.json fetching entirely - CLOUDFLARE_CF_FETCH_PATH: use a custom cache location for cf.json Updates both the system environment variables reference page and the Miniflare get-started guide. Related: cloudflare/workers-sdk#12469 Co-Authored-By: pbacondarwin@cloudflare.com <pete@bacondarwin.com>
3f613d6 to
84af6d4
Compare
84af6d4 to
5f7234d
Compare
Adds two new environment variables that allow users to control the cf.json caching behavior in Miniflare: - CLOUDFLARE_CF_FETCH_ENABLED: Set to "false" or "0" to disable fetching entirely (uses fallback data). Defaults to "true". - CLOUDFLARE_CF_FETCH_PATH: Set to a custom path to use a different location for caching the cf.json file. Empty string is treated as unset. This is useful for non-JavaScript projects (like Rust or Go Workers) that don't want a node_modules directory created automatically. Fixes #3659
5f7234d to
814d321
Compare
Fixes #3659.
Adds two new environment variables that allow users to control the
cf.jsoncaching behavior in Miniflare:CLOUDFLARE_CF_FETCH_ENABLED: Set to "false" to disable fetching entirely and use fallbackRequest.cfdata. No files are created innode_modules/.mf/. Defaults to "true".CLOUDFLARE_CF_FETCH_PATH: Set to a custom path to use a different location for caching the cf.json file instead of the defaultnode_modules/.mf/cf.json. An empty value uses the default path.The explicit
cfoption in Miniflare takes precedence over both environment variables.This is particularly useful for:
node_modulesdirectory created automaticallyExample usage:
A picture of a cute animal (not mandatory, but encouraged)
🦊