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
CfgAuthConfigfrom the on-disk configuration into the matchingAuthBackendKindunderstood byrusmes-auth. - build_
auth_ backend - Build an authentication backend from configuration, defaulting to a
FileAuthBackendrooted in<runtime_dir>/passwdwhen the configuration omits the[auth]section. - build_
storage_ backend - Construct a storage backend from configuration. Wraps
rusmes_storage::build_storagewith aanyhow::Contexttag 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
CfgStorageConfigfrom the on-disk configuration into the matchingBackendKindunderstood byrusmes-storage.