pub struct ConfigLoader { /* private fields */ }Expand description
Configuration loader.
Implementations§
Source§impl ConfigLoader
impl ConfigLoader
Sourcepub fn file<P: AsRef<Path>>(self, path: P) -> Self
pub fn file<P: AsRef<Path>>(self, path: P) -> Self
Specify a configuration file to load.
Multiple files can be specified; later files override earlier ones.
Sourcepub fn with_validation(self, validate: bool) -> Self
pub fn with_validation(self, validate: bool) -> Self
Enable or disable validation after loading.
Sourcepub fn with_validator(self, validator: ConfigValidator) -> Self
pub fn with_validator(self, validator: ConfigValidator) -> Self
Set a custom validator.
Sourcepub fn with_env(self, enabled: bool) -> Self
pub fn with_env(self, enabled: bool) -> Self
Enable or disable environment variable overrides.
When enabled (default), environment variables override config file values:
OPENAI_API_KEY→ sets API key for all LLM clientsVECTORLESS_MODEL→ sets default modelVECTORLESS_ENDPOINT→ sets API endpointVECTORLESS_WORKSPACE→ sets workspace directory
Sourcepub fn load(self) -> Result<Config, ConfigError>
pub fn load(self) -> Result<Config, ConfigError>
Load the configuration.
§Behavior
- Start with default configuration
- Load and merge each specified file (in order)
- Apply environment variable overrides (if enabled)
- Validate configuration (if enabled)
§Errors
Returns an error if:
- A specified file doesn’t exist
- A file can’t be parsed as valid TOML
- Validation fails (when enabled)
Trait Implementations§
Source§impl Debug for ConfigLoader
impl Debug for ConfigLoader
Auto Trait Implementations§
impl Freeze for ConfigLoader
impl !RefUnwindSafe for ConfigLoader
impl Send for ConfigLoader
impl Sync for ConfigLoader
impl Unpin for ConfigLoader
impl UnsafeUnpin for ConfigLoader
impl !UnwindSafe for ConfigLoader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more