oso.framework.config.models namespace

Submodules

oso.framework.config.models.app module

Common Application Config.

class oso.framework.config.models.app.BaseAppConfig(*, name: str, debug: bool = False, root: Path = PosixPath('/app-root'))[source]

Bases: AutoLoadConfig

Application’s basic configuration.

Picked from the environment variables prefixed with APP__.

name

The application’s name.

APP__NAME
Type:

str, default: A

debug

Start the application in debug mode if set to True.

APP__DEBUG
Type:

bool

root

The application’s root directory.

APP__ROOT
Type:

pathlib.Path

oso.framework.config.models.certs module

Certificate Configuration.

class oso.framework.config.models.certs.CertificateConfig(*, ca: str, app_crt: str, app_key: str)[source]

Bases: AutoLoadConfig

Certificate Configuration Set.

An application that requires loading of certificates can import this model to notify the ..ConfigManager that these fields are required. Picked from the environment variables prefixed with CERTS__.

ca

The Certificate Authority for all of the components.

Type:

str, envvar=CERTS__CA

app_crt

The certificate for this application.

Type:

str, envvar=CERTS__APP_CRT

app_key

The private key for this application.

Type:

str, envvar=CERTS__APP_KEY

app_key: str

The private key for this application.

Required:

True

Envvar:

CERTS__APP_KEY

property ca_filename: Path

CA filename.

property crt_filename: Path

Cert filename.

export(root: Path)[source]

Export certificates to filesystem.

property key_filename: Path

Key filename.

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

oso.framework.config.models.logging module

Common Logging Configuration.

class oso.framework.config.models.logging.LoggingConfig(*, level: Annotated[str, _PydanticGeneralMetadata(pattern=re.compile('^(?:-?\\d+|CRITICAL|FATAL|ERROR|WARN|WARNING|INFO|DEBUG|NOTSET)$', re.IGNORECASE))] = 'INFO')

Bases: AutoLoadConfig

Logging configuration.

level

Logging level.

Type:

str, default=INFO, envvar=LOGGING__LEVEL

property level_as_int: int

Logging level as integer.

Return a valid logging level [0, inf]. Value is validated by regex during init.

Returns:

The logging level to use in integer form.

Return type:

int