settings
All configuration via environment.
Take note of the environment variable prefixes required for each
settings class, except AppSettings
.
APISettings ¶
Bases: BaseSettings
API specific configuration.
CACHE_EXPIRATION
class-attribute
¶
Default cache key expiration in seconds.
DB_SESSION_DEPENDENCY_KEY
class-attribute
¶
Parameter name for SQLAlchemy session dependency injection.
DEFAULT_PAGINATION_LIMIT
class-attribute
¶
Max records received for collection routes.
DTO_INFO_KEY
class-attribute
¶
Key used for DTO field config in SQLAlchemy info dict.
HEALTH_PATH
class-attribute
¶
Route that the health check is served under.
AppSettings ¶
Bases: BaseSettings
Generic application settings.
These settings are returned as json by the healthcheck endpoint, so
do not include any sensitive values here, or if you do ensure to
exclude them from serialization in the Config
object.
CHECK_DB_READY
class-attribute
¶
Check for database readiness on startup.
CHECK_REDIS_READY
class-attribute
¶
Check for redis readiness on startup.
LOCAL_ENVIRONMENT_NAME
class-attribute
¶
Value of ENVIRONMENT used to determine if running in local development mode.
This should be the value of ENVIRONMENT
in your local .env
file.
TEST_ENVIRONMENT_NAME
class-attribute
¶
Value of ENVIRONMENT used to determine if running tests.
This should be the value of ENVIRONMENT
in test.env
.
DatabaseSettings ¶
HTTPClientSettings ¶
Bases: BaseSettings
HTTP Client configurations.
LogSettings ¶
Bases: BaseSettings
Logging config for the application.
EXCLUDE_PATHS
class-attribute
¶
Regex to exclude paths from logging.
HTTP_EVENT
class-attribute
¶
Log event name for logs from Starlite handlers.
INCLUDE_COMPRESSED_BODY
class-attribute
¶
Include 'body' of compressed responses in log output.
JOB_FIELDS
class-attribute
¶
JOB_FIELDS: list[str] = [
"function",
"kwargs",
"key",
"scheduled",
"attempts",
"completed",
"queued",
"started",
"result",
"error",
]
Attributes of the SAQ.
Job
to be
logged.
OBFUSCATE_COOKIES
class-attribute
¶
Request cookie keys to obfuscate.
OBFUSCATE_HEADERS
class-attribute
¶
Request header keys to obfuscate.
REQUEST_FIELDS
class-attribute
¶
REQUEST_FIELDS: list[RequestExtractorField] = [
"path",
"method",
"headers",
"cookies",
"query",
"path_params",
"body",
]
Attributes of the Request to be logged.
UVICORN_ACCESS_LEVEL
class-attribute
¶
Level to log uvicorn access logs.
UVICORN_ERROR_LEVEL
class-attribute
¶
Level to log uvicorn error logs.
WORKER_EVENT
class-attribute
¶
Log event name for logs from SAQ worker.
OpenAPISettings ¶
Bases: BaseSettings
Configures OpenAPI for the application.
CONTACT_EMAIL
class-attribute
¶
Email for contact on document.
RedisSettings ¶
Bases: BaseSettings
Redis settings for the application.
URL
class-attribute
¶
A Redis connection URL.
SentrySettings ¶
ServerSettings ¶
WorkerSettings ¶
Bases: BaseSettings
Global SAQ Job configuration.
JOB_HEARTBEAT
class-attribute
¶
Max time a job can survive without emitting a heartbeat. 0
to disable.
job.update()
will trigger a heartbeat.
JOB_RETRY_BACKOFF
class-attribute
¶
If true, use exponential backoff for retry delays.
- The first retry will have whatever retry_delay is.
- The second retry will have retry_delay2. The third retry will have retry_delay4. And so on.
- This always includes jitter, where the final retry delay is a random number between 0 and the calculated retry delay.
- If retry_backoff is set to a number, that number is the maximum retry delay, in seconds."
JOB_RETRY_DELAY
class-attribute
¶
Seconds to delay before retrying a job.
JOB_TIMEOUT
class-attribute
¶
Max time a job can run for, in seconds.
Set to 0
for no timeout.
JOB_TTL
class-attribute
¶
Lifetime of available job information, in seconds.
0: indefinite -1: disabled (no info retained)