env variables get wiped out during deploying changes via cli (i.e. wrangler publish)

I noticed that the env variables I have set up for the worker via the dashboard get deleted every time I deploy changes to the worker vie cli using wrangler publish. Is it an expected behavior?
1 Reply
Unsmart
Unsmart2y ago
Yes that is expected. Generally you should put all your variables in the wrangler.toml or use secrets. You can use --keep-vars though not recommended
Want results from more Discord servers?
Add your server