Enhance Starlette Config
with fastenv
#19
br3ndonland
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Starlette offers a
Config
model for managing settings related to a Starlette application.This model is simple and useful, but has some limitations.
One of the issues with the Starlette
Config
model is that it can only load a single.env
file (encode/starlette#432).Another issue is that, if the
.env
file is not found, Starlette fails silently instead of raising an exception. Applications often depend on environment variable values to function properly, so without an exception, the application may start up and behave unexpectedly.fastenv could be used to enhance the functionality of the Starlette
Config
model.Suggestions
Add Starlette as an optional dependency
Add Starlette as an optional dependency in
pyproject.toml
.Enhance the Starlette
Config
model with fastenvAdd a subpackage
fastenv.settings
.Add a module
fastenv.settings.starlette_config
that importsstarlette.config
and overrides its__init__()
and_read_file()
functions with logic from fastenv.Rough suggestion:
Export the Starlette
Config
modelAdd the model to
fastenv.__init__
to export it.Related
Beta Was this translation helpful? Give feedback.
All reactions