pub struct Config {
pub machine_id: Option<String>,
pub hooks: HooksConfig,
pub history: String,
pub otel: OtelConfig,
pub tui: TuiConfig,
/* private fields */
}Fields§
§machine_id: Option<String>Explicit machine identifier. If None, uses hostname.
hooks: HooksConfig§history: StringData history period for garbage collection. Default: 1000 days. Supports suffixes: ‘d’ (days), ‘h’ (hours), ‘m’ (minutes), ‘s’ (seconds), or raw seconds.
otel: OtelConfigOpenTelemetry server configuration.
tui: TuiConfigTUI configuration (columns, theme, animations, etc.).
Implementations§
Source§impl Config
impl Config
Sourcepub fn load_with_source() -> Result<(Self, ConfigSource), ConfigError>
pub fn load_with_source() -> Result<(Self, ConfigSource), ConfigError>
Load config with source information.
Config resolution order:
<mi6_dir>/config.toml(if exists)- Built-in defaults
The mi6 directory is determined by MI6_DIR_PATH env var or defaults to ~/.mi6.
Sourcepub fn load() -> Result<Self, ConfigError>
pub fn load() -> Result<Self, ConfigError>
Load config (convenience method that discards source)
Sourcepub fn db_path() -> Result<PathBuf, ConfigError>
pub fn db_path() -> Result<PathBuf, ConfigError>
Get the database path.
Returns <mi6_dir>/mi6.db.
Sourcepub fn source(&self) -> ConfigSource
pub fn source(&self) -> ConfigSource
Get the source from which this config was loaded.
Sourcepub fn mi6_dir() -> Result<PathBuf, ConfigError>
pub fn mi6_dir() -> Result<PathBuf, ConfigError>
Get the mi6 directory path.
Returns MI6_DIR_PATH if set, otherwise ~/.mi6.
Sourcepub fn machine_id(&self) -> String
pub fn machine_id(&self) -> String
Get the machine ID.
Resolution order:
machine_idfrom config file (if set)- Hostname
- “unknown” fallback
Sourcepub fn history_duration(&self) -> Duration
pub fn history_duration(&self) -> Duration
Get the history period as a Duration.
Falls back to default if the history string is invalid.
Sourcepub fn save(&self) -> Result<(), ConfigError>
pub fn save(&self) -> Result<(), ConfigError>
Save the configuration to disk.
Writes to <mi6_dir>/config.toml, ensuring the mi6 directory exists.