from functools import lru_cache from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): app_name: str = "Agmail API" environment: str = "development" api_prefix: str = "/api/v1" cors_origins: list[str] = ["http://localhost:5173"] database_url: str = ( "postgresql+asyncpg://agmail:agmail_dev_password" "@localhost:5432/agmail_profiles" ) mongo_url: str = ( "mongodb://agmail:agmail_dev_password@localhost:27017" "/?authSource=admin" ) mongo_database: str = "agmail_messages" jwt_secret: str = "replace-this-development-secret" access_token_minutes: int = 60 platform_domain: str = "gentic.email" platform_spf_include: str = "_spf.gentic.email" app_public_host: str = "gentic.email" dkim_selector: str = "agmail" # Outbound via self-hosted Postfix (Docker service `smtp` by default) smtp_host: str = "smtp" smtp_port: int = 25 smtp_public_host: str = "mail.gentic.email" smtp_username: str = "" smtp_password: str = "" smtp_use_tls: bool = False smtp_timeout: int = 30 smtp_health_required: bool = False relay_domains_file: str = "/data/relay_domains/domains.list" inbound_smtp_enabled: bool = True inbound_smtp_host: str = "127.0.0.1" inbound_smtp_port: int = 2525 inbound_allowed_cidrs: list[str] = [ "127.0.0.0/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", ] inbound_max_bytes: int = 25 * 1024 * 1024 gcs_raw_mime_bucket: str = "" gcs_raw_mime_prefix: str = "raw" gcs_project: str | None = None dns_setup_username: str = "smtp-credentia" dns_setup_password: str = "Nishtha#01" model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", extra="ignore", ) @lru_cache def get_settings() -> Settings: return Settings()