pub struct Config {
pub watchers: Vec<String>,
pub auto_link: bool,
pub auto_link_threshold: f64,
pub commit_footer: bool,
pub machine_id: Option<String>,
pub machine_name: Option<String>,
pub cloud_url: Option<String>,
pub encryption_salt: Option<String>,
pub use_keychain: bool,
}Expand description
Lore configuration settings.
Controls watcher behavior, auto-linking, and commit integration.
Loaded from ~/.lore/config.yaml when available.
Fields§
§watchers: Vec<String>List of enabled watcher names (e.g., “claude-code”, “cursor”).
auto_link: boolWhether to automatically link sessions to commits.
auto_link_threshold: f64Minimum confidence score (0.0-1.0) required for auto-linking.
Whether to append session references to commit messages.
machine_id: Option<String>Unique machine identifier (UUID) for cloud sync deduplication.
Auto-generated on first access via get_or_create_machine_id().
machine_name: Option<String>Human-readable machine name.
Defaults to hostname if not set. Can be customized by the user.
cloud_url: Option<String>Cloud service URL for sync operations.
Defaults to the official Lore cloud service. Can be customized for self-hosted deployments.
encryption_salt: Option<String>Salt for encryption key derivation (base64-encoded).
Generated on first cloud push and stored for consistent key derivation. This is NOT secret - only the passphrase needs to be kept private.
use_keychain: boolWhether to use the OS keychain for credential storage.
When false (default), credentials are stored in ~/.lore/credentials.json. When true, uses macOS Keychain, GNOME Keyring, or Windows Credential Manager. Note: Keychain may prompt for permission on first access.
Implementations§
Source§impl Config
impl Config
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Loads configuration from the default config file.
Returns default configuration if the file does not exist.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Saves configuration to the default config file.
Creates the ~/.lore directory if it does not exist.
Sourcepub fn load_from_path(path: &Path) -> Result<Self>
pub fn load_from_path(path: &Path) -> Result<Self>
Loads configuration from a specific path.
Returns default configuration if the file does not exist.
Sourcepub fn save_to_path(&self, path: &Path) -> Result<()>
pub fn save_to_path(&self, path: &Path) -> Result<()>
Saves configuration to a specific path.
Creates parent directories if they do not exist.
Sourcepub fn get_or_create_machine_id(&mut self) -> Result<String>
pub fn get_or_create_machine_id(&mut self) -> Result<String>
Returns the machine UUID, generating and saving a new one if needed.
If no machine_id exists in config, generates a new UUIDv4 and saves it to the config file. This ensures a consistent machine identifier across sessions for cloud sync deduplication.
Sourcepub fn get_machine_name(&self) -> String
pub fn get_machine_name(&self) -> String
Returns the machine name.
If a custom machine_name is set, returns that. Otherwise returns the system hostname. Returns “unknown” if hostname cannot be determined.
Sourcepub fn set_machine_name(&mut self, name: &str) -> Result<()>
pub fn set_machine_name(&mut self, name: &str) -> Result<()>
Sets a custom machine name and saves the configuration.
The machine name is a human-readable identifier for this machine, displayed in session listings and useful for identifying which machine created a session.
Sourcepub fn get_cloud_url(&self) -> String
pub fn get_cloud_url(&self) -> String
Returns the cloud service URL.
If a custom cloud_url is set, returns that. Otherwise returns the default Lore cloud service URL.
Sourcepub fn set_cloud_url(&mut self, url: &str) -> Result<()>
pub fn set_cloud_url(&mut self, url: &str) -> Result<()>
Sets the cloud service URL and saves the configuration.
Sourcepub fn get_or_create_encryption_salt(&mut self) -> Result<String>
pub fn get_or_create_encryption_salt(&mut self) -> Result<String>
Returns the encryption salt (base64-encoded), generating one if needed.
The salt is stored in the config file and used for deriving the encryption key from the user’s passphrase.
Sourcepub fn get(&self, key: &str) -> Option<String>
pub fn get(&self, key: &str) -> Option<String>
Gets a configuration value by key.
Supported keys:
watchers- comma-separated list of enabled watchersauto_link- “true” or “false”auto_link_threshold- float between 0.0 and 1.0commit_footer- “true” or “false”machine_id- the machine UUID (read-only, auto-generated)machine_name- human-readable machine namecloud_url- cloud service URLencryption_salt- salt for encryption key derivation (read-only)
Returns None if the key is not recognized.
Sourcepub fn set(&mut self, key: &str, value: &str) -> Result<()>
pub fn set(&mut self, key: &str, value: &str) -> Result<()>
Sets a configuration value by key.
Supported keys:
watchers- comma-separated list of enabled watchersauto_link- “true” or “false”auto_link_threshold- float between 0.0 and 1.0 (inclusive)commit_footer- “true” or “false”machine_name- human-readable machine namecloud_url- cloud service URL
Note: machine_id and encryption_salt cannot be set manually.
Returns an error if the key is not recognized or the value is invalid.
Sourcepub fn config_path() -> Result<PathBuf>
pub fn config_path() -> Result<PathBuf>
Returns the path to the configuration file.
The configuration file is located at ~/.lore/config.yaml.
Sourcepub fn valid_keys() -> &'static [&'static str]
pub fn valid_keys() -> &'static [&'static str]
Returns the list of valid configuration keys.
Sourcepub fn is_use_keychain_configured() -> Result<bool>
pub fn is_use_keychain_configured() -> Result<bool>
Checks if use_keychain was explicitly set in the config file.
Returns true if the config file exists and contains a use_keychain key, false if the file does not exist or does not contain the key (meaning the default value is being used).