File size: 1,448 Bytes
4c83ab6
 
 
 
 
 
 
 
 
 
 
7da71bc
4c83ab6
 
 
 
 
7da71bc
4c83ab6
 
 
0a367ef
4c83ab6
7da71bc
 
 
 
 
 
 
 
0a367ef
 
 
 
 
 
 
4c83ab6
 
0a367ef
 
 
 
 
 
4c83ab6
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from pathlib import Path

from pydantic import HttpUrl, SecretStr
from pydantic_settings import BaseSettings, SettingsConfigDict


class Settings(BaseSettings):
    azure_tenant_id: str
    azure_client_id: str
    azure_client_secret: SecretStr

    mailbox_user: str
    mail_folder_name: str
    notification_url: HttpUrl
    subscription_expiry_minutes: int = 4230

    host: str = "0.0.0.0"
    port: int = 8000

    database_path: Path = Path("/data/rcmemail.db")
    email_storage_path: Path = Path("/emails")
    log_path: Path = Path("/logs")

    dropbox_app_key: str
    dropbox_app_secret: SecretStr
    dropbox_refresh_token: SecretStr
    dropbox_po_path: str = "/RCM Supply/Inside Sales/POs"
    dropbox_invoice_path: str = "/RCM Supply/Inside Sales/Invoices"
    dropbox_mtr_path: str = "/RCM Supply/MTRs"
    processor_poll_interval: int = 10

    score_weight_filename: float = 0.35
    score_weight_ocr: float = 0.65
    score_freq_multiplier: float = 0.10
    score_min_threshold: float = 0.30
    brief_recipients: str = ""
    dev_alert_recipients: str = ""

    model_config = SettingsConfigDict(env_file=".env", extra="ignore")

    def brief_recipient_list(self) -> list[str]:
        return [r.strip() for r in self.brief_recipients.split(",") if r.strip()]

    def dev_alert_recipient_list(self) -> list[str]:
        return [r.strip() for r in self.dev_alert_recipients.split(",") if r.strip()]


settings = Settings()