Skip to content

Commit

Permalink
Add 'default=' to config classes, add missing key param to event sub …
Browse files Browse the repository at this point in the history
…translator
  • Loading branch information
TheByronHimes committed Jul 15, 2024
1 parent 47d4fc4 commit 1740af9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/ns/adapters/inbound/akafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"],
)
Expand All @@ -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 (
Expand Down
13 changes: 9 additions & 4 deletions src/ns/adapters/outbound/smtp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#

"""Contains the smtp client adapter"""

import logging
import smtplib
import ssl
Expand All @@ -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"
)
Expand Down

0 comments on commit 1740af9

Please sign in to comment.