s365b.core.config

Process configuration read from environment variables.

Only settings needed to start the process live here (database, paths, keys, module allow-list). Everything an admin changes at runtime (schedules, notification recipients, module on/off) is stored in the database.

All variables use the S365B_ prefix, e.g. S365B_DATABASE_URL. Values ending in _FILE point to files, which is how Docker secrets are passed in.

Classes

Settings

Settings for every Mail Safehouse process.

Functions

get_settings() → Settings

Return the process-wide settings, read once from the environment.

Module Contents

class s365b.core.config.Settings[source]

Bases: pydantic_settings.BaseSettings

Settings for every Mail Safehouse process.

Variables:
  • database_url – PostgreSQL URL in SQLAlchemy form, e.g. postgresql+psycopg://s365b:pw@postgres:5432/s365b.

  • master_key_file – File holding the master key that encrypts secrets stored in the database (certificate private keys, SMTP passwords). Generate with s365b generate-master-key.

  • repository_path – Default location of the filesystem backup repository.

  • modules – Allow-list of module IDs this instance may load. Empty means every installed module is allowed. Modules outside the list are never imported, whatever the UI says.

  • base_url – Public URL of the web UI (https://host[:port]), used for links in emails, the Entra sign-in callback and secure cookies.

  • timezone – IANA time zone that backup schedules are written in.

  • web_dir – Built web UI (frontend/dist) to serve at /. Unset or missing means API only.

  • log_level – Minimum log level.

  • log_format – json for containers, console for development.

model_config[source]
database_url: pydantic.SecretStr[source]
master_key_file: pathlib.Path[source]
repository_path: pathlib.Path[source]
modules: Annotated[list[str], pydantic_settings.NoDecode][source]
base_url: str = 'https://localhost'[source]
timezone: str = 'UTC'[source]
web_dir: pathlib.Path | None = None[source]
log_level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] = 'INFO'[source]
log_format: Literal['json', 'console'] = 'json'[source]
libpq_url() → str[source]

Return the database URL in plain libpq form (for psycopg/procrastinate).

Returns:

The URL without SQLAlchemy’s +driver suffix.

s365b.core.config.get_settings() → Settings[source]

Return the process-wide settings, read once from the environment.

Returns:

The cached Settings instance.