refactor: unify service configuration boundary

This commit is contained in:
jxxghp
2026-08-24 05:12:21 +08:00
parent 52c5c14f87
commit cb3c5f008f
19 changed files with 174 additions and 53 deletions
+9 -1
View File
@@ -41,6 +41,14 @@ def configure_service_directory(
_module_loader = modules
def get_service_configs(
config_key: SystemConfigKey,
conf_type: Type[TConf],
) -> list[TConf]:
"""通过组合根登记的读取器返回已校验服务配置。"""
return _config_loader(config_key, conf_type)
class ServiceBaseHelper(Generic[TConf]):
"""通过应用端口查询服务配置和对应运行实例。"""
@@ -57,7 +65,7 @@ class ServiceBaseHelper(Generic[TConf]):
def get_configs(self, include_disabled: bool = False) -> Dict[str, TConf]:
"""返回按名称索引的有效服务配置。"""
configs = _config_loader(self.config_key, self.conf_type)
configs = get_service_configs(self.config_key, self.conf_type)
return {
config.name: config
for config in configs