workerd icon indicating copy to clipboard operation
workerd copied to clipboard

feature(proposal): Bindings for system environment variable

Open pmbanugo opened this issue 1 year ago • 1 comments

At the moment I have to put the values for environment variables as key bindings. I'd like a way to read system environment variables similar to process.env in Node.js. Perhaps one way to make it work could be explicitly binding to a system environment variable. Another option could be specifying it via the runtime/cli.

pmbanugo avatar Oct 04 '22 02:10 pmbanugo

I think it would make sense to allow a text binding to take its value from an environment variable, and this should be easy to implement.

So like:

binding = (name = "bindingName", (fromEnvironment = "VAR_NAME"))

It's important that this be declared explicitly, though, so that secrets from the environment don't accidentally leak to workers.

kentonv avatar Oct 04 '22 02:10 kentonv