Skip to content

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.

Prefix all environment variables with API_, e.g., API_CACHE_EXPIRATION.

Attributes

int

Default cache key expiration in seconds.

int

Max records received for collection routes.

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.

Attributes

str

Identity of the CI build of current app instance.

bool

If True runs Starlite in debug mode.

str

"dev", "prod", etc.

str

Stdlib log level names, "DEBUG", "INFO", etc.

str

App name.

slug property

slug()

A slugified name.

Returns

str self.NAME, all lowercase and hyphens instead of spaces.

DatabaseSettings

Bases: BaseSettings

Configures the database for the application.

Prefix all environment variables with DB_, e.g., DB_URL.

Attributes

bool

Enables SQLAlchemy engine logs.

PostgresDsn

URL for database connection.

OpenAPISettings

Bases: BaseSettings

Configures OpenAPI for the application.

Prefix all environment variables with OPENAPI_, e.g., OPENAPI_TITLE.

Attributes

str

OpenAPI document title.

str

OpenAPI document version.

str

OpenAPI document contact name.

str

OpenAPI document contact email.

RedisSettings

Bases: BaseSettings

Cache settings for the application.

Prefix all environment variables with REDIS_, e.g., REDIS_URL.

Attributes

AnyUrl

A redis connection URL.

SentrySettings

Bases: BaseSettings

Configures sentry for the application.

Attributes

str

The sentry DSN. Set as empty string to disable sentry reporting.

float

% of requests traced by sentry, 0.0 means none, 1.0 means all.