pub struct Config {
pub db_path: Option<String>,
pub machine_id: Option<String>,
pub hooks: HooksConfig,
pub retention: String,
/* private fields */
}Fields§
§db_path: Option<String>Explicit database path. If None, uses default (~/.fyi/events.db).
machine_id: Option<String>Explicit machine identifier. If None, uses hostname. Resolution order: FYI_MACHINE_ID env var > config > hostname > “unknown”
hooks: HooksConfig§retention: StringData retention period for all events. Default: 365 days. Supports suffixes: ‘d’ (days), ‘h’ (hours), ‘m’ (minutes), ‘s’ (seconds), or raw seconds.
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:
FYI_CONFIGenv var (if set and file exists)~/.fyi/config.toml(user global)- Built-in defaults
For per-project database paths, use the FYI_DB_PATH env var.
Sourcepub fn load() -> Result<Self, ConfigError>
pub fn load() -> Result<Self, ConfigError>
Load config (convenience method that discards source)
Sourcepub fn db_path(&self) -> Result<PathBuf, ConfigError>
pub fn db_path(&self) -> Result<PathBuf, ConfigError>
Get the database path.
Resolution order:
FYI_DB_PATHenv var (if set)db_pathfrom config file (if set)- Default:
~/.fyi/events.db
Sourcepub fn source(&self) -> ConfigSource
pub fn source(&self) -> ConfigSource
Get the source from which this config was loaded.
Sourcepub fn user_global_dir() -> Result<PathBuf, ConfigError>
pub fn user_global_dir() -> Result<PathBuf, ConfigError>
Get the user global config directory
Sourcepub fn machine_id(&self) -> String
pub fn machine_id(&self) -> String
Get the machine ID.
Resolution order:
FYI_MACHINE_IDenv var (if set)machine_idfrom config file (if set)- Hostname (current behavior)
- “unknown” fallback
Sourcepub fn retention_duration(&self) -> Duration
pub fn retention_duration(&self) -> Duration
Get the retention period as a Duration.
Falls back to default if the retention string is invalid.