settings
settings
Application configuration and settings management.
Classes
AppConfig
Bases: BaseSettings
Application configuration loaded from .env file and environment variables.
Functions
validate_ssl_cert_path
Validate that SSL cert path exists if provided.
Source code in src/pyetm/config/settings.py
model_post_init
Post-initialization to handle base_url inference and token warnings.
Source code in src/pyetm/config/settings.py
Functions
get_settings
cached
Load AppConfig from .env file and environment variables.
Cached to ensure only one AppConfig instance is created per session. To reload configuration after changing environment variables, use reload_configuration().
Source code in src/pyetm/config/settings.py
reload_configuration
Clear cached configuration and error policy to reload from environment.
This function clears both the settings cache (get_settings) and the error policy cache (get_error_policy), ensuring that the next call to either function will reload configuration from environment variables.
Use this when you need to change configuration at runtime, for example:
import os
os.environ["PYETM_ERROR_MODE"] = "safe"
reload_configuration()
# Next call to get_settings() or get_error_policy() will see the new value
Note: In production code, configuration should typically be set once at startup. This function is primarily useful for testing or interactive environments.