Repository navigation
cf deploy deletes plain-text vars set outside the config: no equivalent of keep_vars
#763
workers-devprod
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Moved from #197. Originally opened by ap-justin on 2026-10-03.
cf version: 1.0.0-beta.12
What happens
cloudflare.config.tshas no equivalent of Wrangler'skeep_vars.cf migratesays so:So after migrating, every
cf deployreplaces the Worker's plain-text vars with what the config declares, and deletes any var set some other way: in the dashboard, over the API, or by another tool. In beta.12's dist, the upload builder takeskeepVars, but the deploy command passeskeepVars: void 0.cf deployhas no--var/--keep-varsflag either.This is the vars half of #72, which covers secrets, where
--secrets-filegives a workaround. Vars have no workaround.Why it matters
Some projects deliberately keep runtime configuration as plain vars that are set outside the config file, so they stay readable on the Worker. In our case a separate operator tool writes them over the API, and the repo's
wrangler.jsoncdeclares none of them, withkeep_vars: true. With Wrangler, a deploy from a checkout ships code and leaves those values alone. Withcf deploy, the same deploy would wipe every one of them. This blocks our migration.Ask
A
keepVarsoption on the worker config (or a--keep-varsdeploy flag), matching Wrangler'skeep_vars: true. Mappingkeep_varsincf migratewould follow from it.lnv-louis commented on 2026-10-03:
I second this.
All reactions