Expand description
TOML config loader for LinkMarks.
Reads ${XDG_CONFIG_HOME:-~/.config}/linkmarks/config.toml and parses
it into a CanonicalConfig. The loader is not hot-reload:
a single read per process is the contract. Hot-reload would require
notify + state synchronization and is out of scope today.
§Fallback policy
- Missing file →
CanonicalConfig::default_rules()(the emptyCanonicalConfig). No error. - Empty file (zero bytes) → defaults, no error.
- Parse error →
CoreError::Storagewith the path attached, soinit/listcan surface a clear diagnostic.
The config shape is intentionally tiny — a single
[canonical.domains.<host>] table — so a hand-written TOML in the
user’s editor stays readable.
Constants§
- DEFAULT_
CONFIG_ BODY - Reference TOML body used by
ensure_default. Kept in sync with the shippedconfig.toml.exampleat the workspace root.
Functions§
- ensure_
default - Write the default config file at the standard XDG path if missing.
- load
- Public entry point: load the default config file.
- load_
from - Load from an explicit path. Used by tests.