Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configuration Surface

Canonical reference for the PostgreSQL-backed settings documents that drive Revaer’s runtime behaviour.

Revaer persists all operator-facing configuration inside the settings_* tables. The API (ConfigService) exposes strongly-typed snapshots that are consumed by the API server, torrent engine, filesystem pipeline, and CLI. Every change flows through a SettingsChangeset, ensuring a single validation path whether commands originate from the setup flow or the admin API.

Snapshot Components

The / .well-known/revaer.json endpoint and revaer setup complete CLI command both return the same structure:

{
  "revision": 42,
  "app_profile": { /* see below */ },
  "engine_profile": { /*…*/ },
  "fs_policy": { /*…*/ },
  "api_keys": [
    { "key_id": "admin", "label": "bootstrap", "enabled": true, "rate_limit": null }
  ]
}

App Profile (settings_app_profile)

FieldTypeDescription
idUUIDSingleton identifier for the current document.
instance_namestringHuman readable label surfaced in the CLI after setup.
mode"setup" or "active"Gatekeeper for the authentication middleware. Setup requests are rejected once the system enters active.
versionintegerOptimistic locking counter maintained by ConfigService.
http_portintegerPublished TCP port for the API server.
bind_addrstring (IPv4/IPv6)Listen address for the API server.
telemetryobjectFree-form map for logging + metrics toggles (e.g. log_level, prometheus).
featuresobjectFeature switches such as fs_extract, par2, sse_backpressure.
immutable_keysarrayList of fields that cannot be mutated via patches (ConfigError::ImmutableField).

Engine Profile (settings_engine_profile)

FieldTypeDescription
implementationstringCurrently libtorrent. Used to select the torrent workflow implementation.
listen_portinteger?Optional external listen port override for the engine.
dhtboolEnables/disables the DHT module.
encryptionstringEncryption requirement (require, prefer, etc.).
max_activeinteger?Cap on concurrently-active torrents; null means unlimited.
max_download_bps / max_upload_bpsinteger?Global rate limits applied by the engine.
sequential_defaultboolDefault sequential downloading behaviour for new torrents.
resume_dirstringFilesystem location where fast-resume artefacts are stored.
download_rootstringDirectory used for in-progress torrent payloads.
trackerobjectTracker configuration (user-agent, announce overrides).

Filesystem Policy (settings_fs_policy)

FieldTypeDescription
library_rootstringDestination directory for completed artefacts.
extractboolWhether completed payloads are extracted.
par2stringoff, verify, or repair depending on PAR2 behaviour.
flattenboolCollapses single-file directories when moving into the library.
move_modestringcopy, move, or hardlink semantics for the FsOps pipeline.
cleanup_keep / cleanup_droparrayGlob patterns retaining or removing files during cleanup.
chmod_file / chmod_dirstring?Optional octal permissions applied to outputs.
owner / groupstring?Optional ownership override for the library root.
umaskstring?Umask applied during FsOps.
allow_pathsarrayAllowed staging/library paths the pipeline accepts.

API Keys & Secrets

Patches can create, update, or revoke keys and named secrets. The request format mirrors SettingsChangeset:

{
  "api_keys": [
    {
      "op": "upsert",
      "key_id": "admin",
      "label": "primary",
      "enabled": true,
      "secret": "optional-override",
      "rate_limit": { "burst": 10, "per_seconds": 1 }
    }
  ],
  "secrets": [
    { "op": "set", "name": "libtorrent.passphrase", "value": "..." }
  ]
}

The API server enforces bucketed rate limits if rate_limit is supplied (burst per per_seconds). Invalid field names or mutations against immutable_keys yield RFC9457 ProblemDetails responses with an invalid_params array matching the JSON pointer returned by ConfigError.

Change Workflows

  • SetupPOST /admin/setup/start issues a one-time token. POST /admin/setup/complete consumes that token, applies the provided SettingsChangeset, forces app_profile.mode to active, and returns the hydrated snapshot along with the generated API key (also echoed in the CLI output).
  • Ongoing updatesPATCH /admin/settings (CLI: revaer settings patch --file changes.json) requires an API key and supports partial documents. Any field omitted from the payload remains untouched.
  • Snapshot accessGET /.well-known/revaer.json (no auth) and GET /health/full both return the revision and enable automation to verify configuration drift. Automation and dashboards can poll these endpoints without authenticating.

Revaer publishes SettingsChanged events on every successful mutation, ensuring subscribers refresh in-memory caches without polling.