Skip to main content

Module config

Module config 

Source
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 FileConfig field-for-field. Kept as a separate type (rather than reusing clap::Args directly) so this module stays independent of the clap derive on main.rs::Args.
FileConfig
TOML config schema. All fields are optional — a missing field falls back to the CLI-supplied value or the built-in default at resolve time. Unknown fields are a hard error (deny_unknown_fields; typo guard).
ResolvedConfig
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 $HOME is unset (best-effort; dev-only edge case).
default_store_path
Default BlueprintStore root, ~/.mse/store. Same $HOME fallback rule as default_config_path. The store is always git-backed; config/CLI only override where the repos live, never whether they persist.
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 is Err — a malformed config file must not be silently ignored (fail-loud).
resolve
3-way merge: CLI > file > built-in default. bind requires a parse step (both CLI and file carry it as a string); a parse error surfaces as Err.