deislabs / wagi

Write HTTP handlers in WebAssembly with a minimal amount of work
Apache License 2.0
889 stars 44 forks source link

Support `.env` file for bulk-loading guest environment variables #95

Closed technosophos closed 3 years ago

technosophos commented 3 years ago

Right now, if you want to pass environment variables to the guest module, you do so on the CLI like this:

$ wagi -e FOO=1 -e BAR=2

We could support a Docker-style (or Heroku style) .env file that had a simple format like this:

FOO=1
BAR=2

I think this could be done simply with an existing Rust crate.

I think the default behavior would be to try to load a $(PWD)/.env file, but with a CLI flag to override. Though if we are reluctant to load by default, we could just add an --env-file=$PATH option.

technosophos commented 3 years ago

As @bacongobbler pointed out in a conversation, it could be unclear what should load a .env. So maybe an explicit flag is the best way to start.