From 43f079873ec7025b547df5bf7b42a3c5ac3f4b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Tue, 19 Nov 2024 08:37:25 +0100 Subject: [PATCH] Dispatch event: Fix --- .../module/dispatch_publishing/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/github_app_geo_project/module/dispatch_publishing/__init__.py b/github_app_geo_project/module/dispatch_publishing/__init__.py index d559010dd4..da6018cd57 100644 --- a/github_app_geo_project/module/dispatch_publishing/__init__.py +++ b/github_app_geo_project/module/dispatch_publishing/__init__.py @@ -22,9 +22,9 @@ class _Destination(BaseModel): """The event type to dispatch""" legacy: bool = False """Transform the content to the legacy format""" - version_type: str + version_type: str | None = None """The version type to dispatch""" - package_type: str + package_type: str | None = None """The package type to dispatch""" image_re: str = ".*" """The image regular expression to dispatch""" @@ -37,7 +37,11 @@ class _Config(BaseModel): """The destinations to dispatch to""" -CONFIG = _Config(**json.loads(os.environ.get("DISPATCH_PUBLISH_CONFIG", "{}"))) +try: + CONFIG = _Config(**json.loads(os.environ.get("DISPATCH_PUBLISH_CONFIG", "{}"))) +except Exception: # pylint: disable=broad-exception-caught + _LOGGER.exception("Error loading the configuration") + CONFIG = _Config() class DispatchPublishing(module.Module[None, None, None]):