Bases: BaseSettings
Configuration for python-package-template.
Values are read from environment variables and optionally
overridden by a .env file.
Source code in src/python_package_template/settings.py
| class ApplicationSettings(BaseSettings):
"""Configuration for python-package-template.
Values are read from environment variables and optionally
overridden by a ``.env`` file.
"""
# if .env is present, it will override the environment variables
model_config = SettingsConfigDict(env_file=".env", extra="ignore")
# use .get_secret_value() to get the value
EXAMPLE_API_KEY: Optional[SecretStr] = Field(default=None, description="the api key")
EXAMPLE_ENDPOINT: Optional[str] = Field(default=None, description="the endpoint")
logging_level: str = Field(
default="DEBUG",
validation_alias=AliasChoices("LOGGING_LEVEL", "logging_level"),
description="Log level (TRACE, DEBUG, INFO, WARNING, ERROR, CRITICAL)",
)
def model_post_init(self, __context):
"""Called after model initialization."""
pass
|
model_post_init(__context)
Called after model initialization.
Source code in src/python_package_template/settings.py
| def model_post_init(self, __context):
"""Called after model initialization."""
pass
|