ZeroIntensity / view.py

The Batteries-Detachable Web Framework
https://view.zintensity.dev
MIT License
206 stars 15 forks source link

Environment Variables #143

Closed ZeroIntensity closed 3 months ago

ZeroIntensity commented 5 months ago

Feature description

View should supply an easy API for working with environment variables, especially through the use of the config (such as adding an env dictionary) and loading .env files. The view.util.env function does exist, but most of the utilities are undocumented as of now.

Feature example API

# view.toml
[env]
SOME_COOL_SETTING = "hello"
# .env
MY_SECRET="hello"
import view

app = new_app(some_setting=view.env("hello"))

Anything else?

Most of this issue is likely as simple as adding python-dotenv and adding an env: Dict[str, Any] to Config.