new common config loading from .env

This commit is contained in:
yanyongyu
2021-01-27 11:39:34 +08:00
parent 2e75671d56
commit 5e3f1b5435
4 changed files with 37 additions and 2 deletions

View File

@ -175,6 +175,7 @@ def init(*, _env_file: Optional[str] = None, **kwargs):
logger.opt(
colors=True).info(f"Current <y><b>Env: {env.environment}</b></y>")
config = Config(**kwargs,
_common_config=env.dict(),
_env_file=_env_file or f".env.{env.environment}")
default_filter.level = "DEBUG" if config.debug else "INFO"