>! >!
! >! >! Use Env_file as a list in the combined class ! >! >! ! >! >! from pydantic_settings import BaseSettings, SettingsConfigDict ! >! >! ! >! >! class Settings(BaseSettings): ! >! >! model_config = SettingsConfigDict( ! >! >! env_prefix="APP_", ! >! >! env_file=[".env.database", ".env.auth"], # multiple files supported ! >! >! env_file_encoding="utf-8", ! >! >! extra="ignore", ! >! >! ) ! >! >! ! >! >! # Explicitly declare fields so IDE knows them ! >! >! db_host: str = "localhost" ! >! >! auth_secret_key: str = "change-me" ! >! >! ! >! >! settings = Settings() ! >! >! print(settings) ! >! >! ! >! >! Settings(db_host='db.example.com', auth_secret_key='secret-from-env-file') ! >! >!