Files
cloudflare_temp_email/smtp_proxy_server/config.py
Josh Tsai 4c1e593d07 fix(imap-proxy): persist IMAP flags and mark mail as read (#1090)
Fix IMAP flag persistence so read/unread state survives reconnects, and align SEARCH/FETCH behavior with persisted flags.

Co-authored-by: bounce12340 <bounce12340@users.noreply.github.com>
2026-07-27 20:15:25 +08:00

44 lines
1.1 KiB
Python

import logging
from pydantic import field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
)
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)
class Settings(BaseSettings):
proxy_url: str = "http://localhost:8787"
port: int = 8025
imap_port: int = 11143
basic_password: str = ""
smtp_tls_cert: str = ""
smtp_tls_key: str = ""
imap_tls_cert: str = ""
imap_tls_key: str = ""
imap_cache_size: int = 500
imap_http_timeout: float = 30.0
imap_flag_db_path: str = "data/imap_flags.db"
model_config = SettingsConfigDict(env_file=".env")
@field_validator("imap_cache_size")
@classmethod
def cache_size_positive(cls, v):
if v <= 0:
raise ValueError("imap_cache_size must be > 0")
return v
@field_validator("imap_http_timeout")
@classmethod
def timeout_positive(cls, v):
if v <= 0:
raise ValueError("imap_http_timeout must be > 0")
return v
settings = Settings()