From 31155dba922f9f0ad5e983b12814cb9173169343 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 4 Nov 2023 15:09:29 +0100 Subject: [PATCH] Fixed technician config loading --- bot/docker | 2 +- bot/src/bot_core/service/config_service.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bot/docker b/bot/docker index 95a4530a..4ccf9fb5 160000 --- a/bot/docker +++ b/bot/docker @@ -1 +1 @@ -Subproject commit 95a4530ae594f3be66e36e2b1af9b86452d9fc3e +Subproject commit 4ccf9fb5db7a22948b9fef1dfadcf1aa2d928637 diff --git a/bot/src/bot_core/service/config_service.py b/bot/src/bot_core/service/config_service.py index 657d972d..2adf621d 100644 --- a/bot/src/bot_core/service/config_service.py +++ b/bot/src/bot_core/service/config_service.py @@ -7,6 +7,7 @@ from bot_data.abc.technician_config_repository_abc import TechnicianConfigReposi from bot_data.model.server import Server from bot_data.model.technician_config import TechnicianConfig from bot_data.service.server_config_seeder import ServerConfigSeeder +from bot_data.service.technician_config_seeder import TechnicianConfigSeeder class ConfigService: @@ -16,17 +17,24 @@ class ConfigService: services: ServiceProviderABC, technician_config_repo: TechnicianConfigRepositoryABC, server_config_repo: ServerConfigRepositoryABC, + technician_seeder: TechnicianConfigSeeder, server_seeder: ServerConfigSeeder, ): self._config = config self._services = services self._technician_config_repo = technician_config_repo + self._technician_seeder = technician_seeder self._server_config_repo = server_config_repo self._server_seeder = server_seeder def reload_technician_config(self): - technician_config = self._technician_config_repo.get_technician_config() + try: + technician_config = self._technician_config_repo.get_technician_config() + except Exception as e: + self._technician_seeder.seed() + technician_config = self._technician_config_repo.get_technician_config() + self._config.add_configuration(TechnicianConfig, technician_config) self._config.add_configuration( FeatureFlagsSettings,