bc-config
Make configuring your application easier.
Installing
pip install bc-configs
Make your custom config class
import os
from bc_configs import BaseConfig
class MyConfig(BaseConfig):
some_int: int
some_string: str
some_bool: bool
my_config = MyConfig()
assert int(os.getenv("MY_SOME_INT")) == my_config.some_int
assert os.getenv("MY_SOME_STRING") == my_config.some_string
assert bool(os.getenv("MY_SOME_BOOL")) == my_config.some_bool
The name of the environment variable is formed based on the names of the class and field.