Skip to main content

Module config

Module config 

Source
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

  1. Missing file → CanonicalConfig::default_rules() (the empty CanonicalConfig). No error.
  2. Empty file (zero bytes) → defaults, no error.
  3. Parse error → CoreError::Storage with the path attached, so init / list can 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 shipped config.toml.example at 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.