Skip to main content

Module bootstrap

Module bootstrap 

Source
Expand description

Server bootstrap: configuration-driven construction of authentication and storage backends, plus PID-file lifecycle management.

This module isolates the conversion logic between the configuration crate (rusmes_config) and the runtime factory APIs exposed by rusmes_auth and rusmes_storage. The bridging here exists because the on-disk configuration intentionally exposes a smaller, user-friendly surface than the full backend configuration types — the helpers below fill in sensible defaults for the fields that the configuration does not surface.

The PID-file helpers cooperate with the signal-handling loop in main.rs: PidFile::write creates the file (overwriting any stale entry) and PidFile::cleanup removes it on graceful shutdown.

Structs§

PidFile
PID file marker conventionally placed under <runtime_dir>/rusmes.pid.

Functions§

auth_kind_from_config
Translate a CfgAuthConfig from the on-disk configuration into the matching AuthBackendKind understood by rusmes-auth.
build_auth_backend
Build an authentication backend from configuration, defaulting to a FileAuthBackend rooted in <runtime_dir>/passwd when the configuration omits the [auth] section.
build_storage_backend
Construct a storage backend from configuration. Wraps rusmes_storage::build_storage with a anyhow::Context tag for the configured backend kind so startup errors are easy to trace.
load_and_validate
Load and validate a configuration file without opening any sockets.
storage_kind_from_config
Translate a CfgStorageConfig from the on-disk configuration into the matching BackendKind understood by rusmes-storage.