Notifications
All checks were successful
Build And Test / publish (push) Successful in 45s

This commit is contained in:
2025-12-30 15:45:50 -08:00
parent 4f6098e8c2
commit 0bbb5a5a2c
10 changed files with 752 additions and 3 deletions

View File

@@ -48,6 +48,42 @@ class Settings(BaseSettings):
enable_calendar: bool = Field(default=True, alias="ENABLE_CALENDAR")
enable_contacts: bool = Field(default=True, alias="ENABLE_CONTACTS")
# Email Notification Settings
enable_email_notifications: bool = Field(
default=False,
alias="ENABLE_EMAIL_NOTIFICATIONS"
)
notification_mailboxes: str = Field(
default="INBOX",
alias="NOTIFICATION_MAILBOXES",
)
notification_poll_interval: int = Field(
default=60,
alias="NOTIFICATION_POLL_INTERVAL",
)
notification_idle_timeout: int = Field(
default=1680, # 28 minutes (RFC recommends refresh before 29 min)
alias="NOTIFICATION_IDLE_TIMEOUT",
)
# Poke Webhook Settings
poke_webhook_url: Optional[str] = Field(
default="https://poke.com/api/v1/inbound-sms/webhook",
alias="POKE_WEBHOOK_URL",
)
poke_api_key: Optional[SecretStr] = Field(
default=None,
alias="POKE_API_KEY",
)
poke_webhook_timeout: int = Field(
default=30,
alias="POKE_WEBHOOK_TIMEOUT",
)
poke_webhook_max_retries: int = Field(
default=3,
alias="POKE_WEBHOOK_MAX_RETRIES",
)
model_config = {
"env_file": ".env",
"env_file_encoding": "utf-8",
@@ -87,5 +123,16 @@ class Settings(BaseSettings):
self.carddav_password,
])
def is_notification_configured(self) -> bool:
return all([
self.enable_email_notifications,
self.is_email_configured(),
self.poke_api_key,
self.poke_webhook_url,
])
def get_notification_mailboxes(self) -> list[str]:
return [m.strip() for m in self.notification_mailboxes.split(",") if m.strip()]
settings = Settings()