@@ -38,6 +38,7 @@ class EntryPoint(EntryPointABC):
3838
3939 default_config_file_paths : List [str ] = []
4040 config_file_only_get_need = True
41+ load_all_config_file = False
4142 env_prefix = None
4243 parse_env = True
4344
@@ -250,18 +251,31 @@ def parse_yaml_configfile_args(self, p: Path) -> Dict[str, Any]:
250251 def parse_configfile_args (self ) -> Dict [str , Any ]:
251252 if not self .default_config_file_paths :
252253 return {}
253- for p_str in self .default_config_file_paths :
254- p = Path (p_str )
255- if p .is_file ():
256- if p .suffix == ".json" :
257- return self .parse_json_configfile_args (p )
258- elif p .suffix == ".yml" :
259- return self .parse_yaml_configfile_args (p )
260- else :
261- warnings .warn (f"跳过不支持的配置格式的文件{ str (p )} " )
254+ if not self .load_all_config_file :
255+ for p_str in self .default_config_file_paths :
256+ p = Path (p_str )
257+ if p .is_file ():
258+ if p .suffix == ".json" :
259+ return self .parse_json_configfile_args (p )
260+ elif p .suffix == ".yml" :
261+ return self .parse_yaml_configfile_args (p )
262+ else :
263+ warnings .warn (f"跳过不支持的配置格式的文件{ str (p )} " )
264+ else :
265+ warnings .warn ("配置文件的指定路径都不可用." )
266+ return {}
262267 else :
263- warnings .warn ("配置文件的指定路径都不可用." )
264- return {}
268+ result = {}
269+ for p_str in self .default_config_file_paths :
270+ p = Path (p_str )
271+ if p .is_file ():
272+ if p .suffix == ".json" :
273+ result .update (self .parse_json_configfile_args (p ))
274+ elif p .suffix == ".yml" :
275+ result .update (self .parse_yaml_configfile_args (p ))
276+ else :
277+ warnings .warn (f"跳过不支持的配置格式的文件{ str (p )} " )
278+ return result
265279
266280 def validat_config (self ) -> bool :
267281 if self .verify_schema :
0 commit comments