Expand description
Server config file support (~/.mse/config.toml, CLI > file > default merge).
Server config file support (~/.mse/config.toml by default).
Resolution precedence: CLI flag > config file > built-in default.
CLI flags are represented as Option<T> on the main.rs Args struct
(rather than relying on clap’s default_value) so “not passed” can be
distinguished from “matches the default value”; [resolve] performs the
actual 3-way merge.
Design rationale: the config file becomes the lifecycle SoT; the launchd
plist’s ProgramArguments stays fixed at <server-bin> --config <path>,
so changing settings = editing the file + restarting, not editing the plist.
Structs§
- CliOverrides
- CLI-side overrides. Mirrors
FileConfigfield-for-field. Kept as a separate type (rather than reusingclap::Argsdirectly) so this module stays independent of theclapderive onmain.rs::Args. - File
Config - TOML config schema. All fields are optional — a missing field falls back
to the CLI-supplied value or the built-in default at
resolvetime. Unknown fields are a hard error (deny_unknown_fields; typo guard). - Resolved
Config - Fully resolved config — every field has the built-in default applied.
Functions§
- default_
config_ path - Default config path,
~/.mse/config.toml. Falls back to a relative path literal when$HOMEis unset (best-effort; dev-only edge case). - load_
file_ config - Load + parse a TOML config file. A missing file resolves to
Ok(FileConfig::default())(built-in default fallback, per module doc); any other IO error or a parse error isErr— a malformed config file must not be silently ignored (fail-loud). - resolve
- 3-way merge: CLI > file > built-in default.
bindrequires a parse step (both CLI and file carry it as a string); a parse error surfaces asErr.