From 1740af9bf4ad1f3343fb86d711e606476ff844ec Mon Sep 17 00:00:00 2001 From: TheByronHimes Date: Mon, 15 Jul 2024 14:15:53 +0000 Subject: [PATCH] Add 'default=' to config classes, add missing key param to event sub translator --- src/ns/adapters/inbound/akafka.py | 7 ++++--- src/ns/adapters/outbound/smtp_client.py | 13 +++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ns/adapters/inbound/akafka.py b/src/ns/adapters/inbound/akafka.py index 432dda4..f0909af 100644 --- a/src/ns/adapters/inbound/akafka.py +++ b/src/ns/adapters/inbound/akafka.py @@ -14,6 +14,7 @@ # limitations under the License. # """Event subscriber details for notification events""" + import ghga_event_schemas.pydantic_ as event_schemas from ghga_event_schemas.validation import get_validated_payload from hexkit.custom_types import Ascii, JsonObject @@ -28,12 +29,12 @@ class EventSubTranslatorConfig(BaseSettings): """Config for the event subscriber""" notification_event_topic: str = Field( - ..., + default=..., description="Name of the event topic used to track notification events", examples=["notifications"], ) notification_event_type: str = Field( - ..., + default=..., description="The type to use for events containing content to be sent", examples=["notification"], ) @@ -56,7 +57,7 @@ async def _send_notification(self, *, payload: JsonObject): await self._notifier.send_notification(notification=validated_payload) async def _consume_validated( - self, *, payload: JsonObject, type_: Ascii, topic: Ascii + self, *, payload: JsonObject, type_: Ascii, topic: Ascii, key: Ascii ) -> None: """Consumes an event""" if ( diff --git a/src/ns/adapters/outbound/smtp_client.py b/src/ns/adapters/outbound/smtp_client.py index 42b969e..b800276 100644 --- a/src/ns/adapters/outbound/smtp_client.py +++ b/src/ns/adapters/outbound/smtp_client.py @@ -15,6 +15,7 @@ # """Contains the smtp client adapter""" + import logging import smtplib import ssl @@ -31,10 +32,14 @@ class SmtpClientConfig(BaseSettings): """Configuration details for the SmtpClient""" - smtp_host: str = Field(..., description="The mail server host to connect to") - smtp_port: int = Field(..., description="The port for the mail server connection") - login_user: str = Field(..., description="The login username or email") - login_password: SecretStr = Field(..., description="The login password") + smtp_host: str = Field( + default=..., description="The mail server host to connect to" + ) + smtp_port: int = Field( + default=..., description="The port for the mail server connection" + ) + login_user: str = Field(default=..., description="The login username or email") + login_password: SecretStr = Field(default=..., description="The login password") use_starttls: bool = Field( default=True, description="Boolean flag indicating the use of STARTTLS" )