Skip to content

Commit

Permalink
Small refactoring for MaintenanceEnvironmentManager
Browse files Browse the repository at this point in the history
  • Loading branch information
MCPN committed Dec 8, 2023
1 parent f9ed2e8 commit fd4ff71
Showing 1 changed file with 9 additions and 4 deletions.
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_constants.enums import ConnectionType
from dl_configs.connectors_settings import ConnectorSettingsBase
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

0 comments on commit fd4ff71

Please sign in to comment.