This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user