Skip to main content

LacsConfig

Struct LacsConfig 

Source
pub struct LacsConfig {
    pub daemon: Option<DaemonSection>,
    pub llm: Option<LlmSection>,
    pub policy: Option<PolicySection>,
    pub audit: Option<AuditSection>,
    pub storage: Option<StorageSection>,
}
Expand description

Top-level structure of ~/.config/sysknife/config.toml.

All fields are optional — absent sections use built-in defaults.

Fields§

§daemon: Option<DaemonSection>§llm: Option<LlmSection>§policy: Option<PolicySection>§audit: Option<AuditSection>§storage: Option<StorageSection>

Implementations§

Source§

impl LacsConfig

Source

pub fn config_path() -> PathBuf

Returns the path to the config file (~/.config/sysknife/config.toml).

Source

pub fn load() -> Self

Load ~/.config/sysknife/config.toml.

Returns LacsConfig::default() (all None) if the file is absent — this is the normal, unconfigured happy path and is unchanged.

If the file IS present but cannot be parsed as TOML, or exists but cannot be read (e.g. permission denied), this is treated as a fatal misconfiguration rather than silently falling back to defaults: a clear message is printed to stderr and the process exits with status 1. Silently defaulting in that case would drop [storage] / [policy] overrides (backend selection, risk-level overrides) without any indication to the operator — a silent security downgrade. See try_load for the non-exiting core used by tests.

Source

pub fn apply_defaults_to_env(&self)

Set environment variables from the config file for any key that is NOT already present in the process environment.

§Safety note

This must be called during single-threaded startup, before the async runtime or any thread pool is initialised. Modifying env vars while other threads are reading them is undefined behaviour. Both main.rs (daemon) and the Tauri setup hook (shell) satisfy this contract.

Trait Implementations§

Source§

impl Debug for LacsConfig

Source§

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

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

impl Default for LacsConfig

Source§

fn default() -> LacsConfig

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

impl<'de> Deserialize<'de> for LacsConfig

Source§

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

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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