#Update Worker's Env Var through the API

3 messages · Page 1 of 1 (latest)

crude sentinel
#

I would like to be able to update a Cloudflare worker's env var through the API. It seems like there is a REST endpoint, that allows me to upload a whole new script for a worker + the environment variables, but no endpoint to just update the environment variables themselves + redeploy.

Updating the whole script is way too complex for us, as well as error prone, is there a workaround for this? Would it be better to potentially use KV as a storage mechanism for these settings (postgres connection strings and JWT tokens) if env vars are not able to be updated standalone through the API? Or am I missing something in the documentation?

mental minnow
#

Unfortunately I'm not aware of any way to update env vars without also updating the worker script. Even the dash does it this way behind the scenes.

crude sentinel
#

If I wanted to update the worker's env var from an entirely separate process, then it wouldn't have access to the worker's codebase. Wonder if this is a feature request