🔧 load extra config value from env if empty in file

This commit is contained in:
yanyongyu 2020-09-14 22:38:03 +08:00
parent adc69a2763
commit 50601934b9

View File

@ -79,6 +79,9 @@ class BaseConfig(BaseSettings):
if env_file_vars: if env_file_vars:
for env_name, env_val in env_file_vars.items(): 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: try:
env_val = self.__config__.json_loads(env_val) env_val = self.__config__.json_loads(env_val)
except ValueError as e: except ValueError as e: