Static var in workers

Hi, I’ve got a very simple worker that depends on a fixed value that I need to change occasionally, under external program control. Is there any easy way to store this without signing up for the full KV experience? It’s only a single 16bit number!

I’d rather not fetch it from an exernal website, as I feel that that’s liable to be slow, doing it for every request. At the moment it’s a const and I’m manually updating the worker itself when necessary, but that’s not a long term solution as I can’t be about 24/7 in case it’s needed…

You can use environment variables for that: https://developers.cloudflare.com/workers/reference/apis/environment-variables/

1 Like