mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
refactor: unify service configuration boundary
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user