app.config¶
Application configuration loaded from the environment.
All runtime configuration is sourced from a single
pydantic-settings Settings class. Every environment
variable is prefixed with ADRIANO_ to avoid collisions with other
services, and the settings object is instantiated once per process
through get_settings().
Invalid configuration fails loudly: a missing or malformed
ADRIANO_DATABASE_URL, a malformed ADRIANO_OIDC_AUTHORITY or an
incomplete SPA OIDC configuration raises a ValidationError when the
settings are built, i.e. at process start.
- class app.config.Settings(_case_sensitive=None, _nested_model_default_partial_update=None, _env_prefix=None, _env_prefix_target=None, _env_file=PosixPath('.'), _env_file_encoding=None, _env_file_depth=None, _env_ignore_empty=None, _env_nested_delimiter=None, _env_nested_max_split=None, _env_parse_none_str=None, _env_parse_enums=None, _cli_prog_name=None, _cli_parse_args=None, _cli_settings_source=None, _cli_parse_none_str=None, _cli_hide_none_type=None, _cli_avoid_json=None, _cli_enforce_required=None, _cli_use_class_docs_for_groups=None, _cli_show_env_vars=None, _cli_exit_on_error=None, _cli_prefix=None, _cli_flag_prefix_char=None, _cli_implicit_flags=None, _cli_ignore_unknown_args=None, _cli_kebab_case=None, _cli_shortcuts=None, _secrets_dir=None, _build_sources=None, *, database_url, test_database_url=PostgresDsn('postgresql://adriano:adriano@localhost:55432/adriano_test'), config_file='catalog.yaml', oidc_authority=None, oidc_issuer=None, oidc_audience='adr_viewer', oidc_roles_claim='roles', oidc_client_id=None, oidc_scope='openid profile email', oidc_redirect_uri=None, oidc_post_logout_redirect_uri=None, dev_auth_enabled=False, dev_shared_secret=None, stale_after_minutes=120, static_dir=None, migrate_on_start=True, tls_verify=True, extra_ca_certs=None, version='dev', workers=4, forwarded_allow_ips=None)¶
Bases:
BaseSettingsTyped application settings sourced from the environment.
- Variables:
database_url (
PostgresDsn) – Plainpostgresql://DSN for the application database, validated at startup. Required: there is no default. The SQLAlchemy+psycopgdialect modifier is injected at runtime, never stored here.test_database_url (
PostgresDsn) – DSN used only by the test suite.config_file (
str) – Path to thecatalog.yamlsource and policy configuration file.oidc_authority (
str|None) – OIDC discovery authority base URL, shared by the backend (token validation) and the SPA (sign-in). Must behttp(s)://host[:port][/path].oidc_audience (
str) – Expected JWTaudclaim.oidc_roles_claim (
str) – Dotted path to the roles claim in the validated token payload.oidc_client_id (
str|None) – Public OIDC client id the SPA signs in with (served in/config.js).oidc_scope (
str) – OIDC scopes the SPA requests at sign-in.oidc_redirect_uri (
str|None) – Redirect URI for the SPA’s authorization code callback; unset, the SPA uses<origin>/auth/callback.oidc_post_logout_redirect_uri (
str|None) – Where the IdP sends the browser after sign-out; unset, the SPA uses its origin.dev_auth_enabled (
bool) – Whether the dev-only HS256 auth bypass is mounted. Must beFalsein production.dev_shared_secret (
str|None) – Shared secret for the dev-only auth bypass. Has no default; must be explicitly configured.stale_after_minutes (
int) – Minutes after the last successful poll of a registration before its freshness is reported asstale(seeGET /api/v1/sourcesand the record detail freshness field).static_dir (
Path|None) – Directory holding the built SPA (index.html,assets/). When set, the API process also serves the SPA and/config.js(seeapp.web); unset, it serves the API only.tls_verify (
bool) – Whether outbound HTTPS calls (OIDC discovery, the JWKS endpoint, network sources such as GitLab) verify the server certificate.Falsedisables verification entirely; meant only as a stop-gap for non-production instances behind an internal CA.extra_ca_certs (
tuple[Path,...] |None) – PEM files (bundles allowed) and directories (their*.pemand*.crtfiles) whose certificates outbound HTTPS trusts in addition to the standard set, e.g. an internal CA. Comma-separated in the environment; every path must exist. Unset (or blank) trusts the standard set only. Ignored whentls_verifyisFalse. Loaded byapp.tls.migrate_on_start (
bool) – Whetheradriano serveapplies the database migrations (under an advisory lock) before starting the server.version (
str) – Application version reported by/healthzand the OpenAPI document; set from the image build.workers (
int) – Number of Uvicorn worker processes started byadriano serve.forwarded_allow_ips (
str|None) – Comma-separated proxy addresses whoseX-Forwarded-*headers Uvicorn trusts (adriano serve); unset keeps Uvicorn’s default (127.0.0.1).
- model_config = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_show_env_vars': False, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': '.env', 'env_file_depth': 0, 'env_file_encoding': 'utf-8', 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': 'ADRIANO_', 'env_prefix_target': 'variable', 'extra': 'ignore', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_cached', 'settings_clear_cache', 'settings_customise_sources'), 'secrets_case_sensitive': None, 'secrets_dir': None, 'secrets_dir_max_size': None, 'secrets_dir_missing': None, 'secrets_nested_delimiter': None, 'secrets_nested_subdir': None, 'secrets_prefix': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- database_url: PostgresDsn¶
- test_database_url: PostgresDsn¶
- property oidc_origin: str | None¶
The
scheme://host[:port]origin ofoidc_authority.- Returns:
The origin,
Nonewhen no authority is set.