BaseSettings
settus.BaseSettings
¤
Bases: BaseSettings
Base Settings class.
Examples:
import os
from settus import BaseSettings
from settus import Field
from settus import SettingsConfigDict
KEYVAULT_URL = "https://o3-kv-settus-dev.vault.azure.net/"
os.environ["MY_ENV"] = "my_value"
class Settings(BaseSettings):
model_config = SettingsConfigDict(keyvault_url=KEYVAULT_URL)
my_env: str = Field(default="undefined")
my_azure_secret: str = Field(default="undefined", alias="my-secret")
settings = Settings()
print(settings)
#> my_env='my_value' my_azure_secret='secretsauce'
Functions¤
settings_customise_sources
classmethod
¤
settings_customise_sources(settings_cls, init_settings, env_settings, dotenv_settings, file_secret_settings)
Supported sources and priority. Can be subclassed to overwrite the default priority list:
- Init values
- Environment variables
- Azure keyvault settings
- AWS Secrets Manager
PARAMETER | DESCRIPTION |
---|---|
settings_cls |
Definition of base class
TYPE:
|
init_settings |
Values provided from fields init
TYPE:
|
env_settings |
Values provided from environment variables
TYPE:
|
dotenv_settings |
Values provided from .env file
TYPE:
|
file_secret_settings |
Values provided from secrets file
TYPE:
|
Source code in settus/basesettings.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|