模块化
This commit is contained in:
21
app/services/profile_resolver.py
Normal file
21
app/services/profile_resolver.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.models import AppConfig, ResolvedProfile
|
||||
|
||||
|
||||
def resolve_profile(
|
||||
*,
|
||||
app_config: AppConfig,
|
||||
client_type: str,
|
||||
selected_source_names: list[str],
|
||||
) -> ResolvedProfile:
|
||||
client = app_config.clients[client_type]
|
||||
return ResolvedProfile(
|
||||
client_type=client_type,
|
||||
client=client,
|
||||
selected_sources={name: app_config.sources[name] for name in selected_source_names if name in app_config.sources},
|
||||
rules=dict(app_config.rules),
|
||||
regions=dict(app_config.regions),
|
||||
selector_groups=list(app_config.selector_groups),
|
||||
policy_groups=list(app_config.policy_groups),
|
||||
)
|
||||
Reference in New Issue
Block a user