Skip to main content

Config

Struct Config 

Source
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: bool

Whether to automatically link sessions to commits.

§auto_link_threshold: f64

Minimum confidence score (0.0-1.0) required for auto-linking.

§commit_footer: bool

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: bool

Whether 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

Source

pub fn load() -> Result<Self>

Loads configuration from the default config file.

Returns default configuration if the file does not exist.

Source

pub fn save(&self) -> Result<()>

Saves configuration to the default config file.

Creates the ~/.lore directory if it does not exist.

Source

pub fn load_from_path(path: &Path) -> Result<Self>

Loads configuration from a specific path.

Returns default configuration if the file does not exist.

Source

pub fn save_to_path(&self, path: &Path) -> Result<()>

Saves configuration to a specific path.

Creates parent directories if they do not exist.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn set_cloud_url(&mut self, url: &str) -> Result<()>

Sets the cloud service URL and saves the configuration.

Source

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.

Source

pub fn get(&self, key: &str) -> Option<String>

Gets a configuration value by key.

Supported keys:

  • watchers - comma-separated list of enabled watchers
  • auto_link - “true” or “false”
  • auto_link_threshold - float between 0.0 and 1.0
  • commit_footer - “true” or “false”
  • machine_id - the machine UUID (read-only, auto-generated)
  • machine_name - human-readable machine name
  • cloud_url - cloud service URL
  • encryption_salt - salt for encryption key derivation (read-only)

Returns None if the key is not recognized.

Source

pub fn set(&mut self, key: &str, value: &str) -> Result<()>

Sets a configuration value by key.

Supported keys:

  • watchers - comma-separated list of enabled watchers
  • auto_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 name
  • cloud_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.

Source

pub fn config_path() -> Result<PathBuf>

Returns the path to the configuration file.

The configuration file is located at ~/.lore/config.yaml.

Source

pub fn valid_keys() -> &'static [&'static str]

Returns the list of valid configuration keys.

Source

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).

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Config) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,