Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small refactoring for MaintenanceEnvironmentManager #158

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/dl_maintenance/dl_maintenance/api/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@


if TYPE_CHECKING:
from dl_configs.connectors_settings import ConnectorSettingsBase
from dl_constants.enums import ConnectionType
from dl_core.services_registry.sr_factories import SRFactory


Expand All @@ -48,16 +50,19 @@ def get_app_settings(self) -> AppSettings:
)
return settings

def get_connector_settings(self) -> dict[ConnectionType, ConnectorSettingsBase]:
return load_connectors_settings_from_env_with_fallback(
settings_registry=CONNECTORS_SETTINGS_CLASSES,
fallbacks=CONNECTORS_SETTINGS_FALLBACKS,
)

def get_sr_factory(self, is_async_env: bool) -> Optional[SRFactory]:
assert self._app_factory_cls is not None
conn_opts_factory = ConnOptionsMutatorsFactory()
settings = self.get_app_settings()
sr_factory = self._app_factory_cls(settings=settings).get_sr_factory( # type: ignore
settings=settings,
conn_opts_factory=conn_opts_factory,
connectors_settings=load_connectors_settings_from_env_with_fallback(
settings_registry=CONNECTORS_SETTINGS_CLASSES,
fallbacks=CONNECTORS_SETTINGS_FALLBACKS,
),
connectors_settings=self.get_connector_settings(),
)
return sr_factory
Loading