From 50601934b952cbe9733265a3a4a7567881ef12fd Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Mon, 14 Sep 2020 22:38:03 +0800 Subject: [PATCH] :wrench: load extra config value from env if empty in file --- nonebot/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nonebot/config.py b/nonebot/config.py index f88b12b5..7b9281fb 100644 --- a/nonebot/config.py +++ b/nonebot/config.py @@ -79,6 +79,9 @@ class BaseConfig(BaseSettings): if env_file_vars: for env_name, env_val in env_file_vars.items(): + if (env_val is None or + len(env_val) == 0) and env_name in env_vars: + env_val = env_vars[env_name] try: env_val = self.__config__.json_loads(env_val) except ValueError as e: