pub struct ConfigLoader { /* private fields */ }
Expand description
Configuration loader that handles multiple sources with precedence
Implementations§
Source§impl ConfigLoader
impl ConfigLoader
Sourcepub fn with_base_config(self, config: McpServerConfig) -> Self
pub fn with_base_config(self, config: McpServerConfig) -> Self
Set the base configuration
Sourcepub fn add_config_path<P: AsRef<Path>>(self, path: P) -> Self
pub fn add_config_path<P: AsRef<Path>>(self, path: P) -> Self
Add a configuration file path
Sourcepub fn with_config_paths<P: AsRef<Path>>(self, paths: Vec<P>) -> Self
pub fn with_config_paths<P: AsRef<Path>>(self, paths: Vec<P>) -> Self
Set configuration file paths
Sourcepub fn without_env_loading(self) -> Self
pub fn without_env_loading(self) -> Self
Disable loading from environment variables
Sourcepub fn with_env_loading(self, enabled: bool) -> Self
pub fn with_env_loading(self, enabled: bool) -> Self
Enable or disable loading from environment variables
Sourcepub fn with_validation(self, enabled: bool) -> Self
pub fn with_validation(self, enabled: bool) -> Self
Enable or disable configuration validation
Sourcepub fn load(&self) -> Result<McpServerConfig>
pub fn load(&self) -> Result<McpServerConfig>
Load configuration from all sources
§Errors
Returns an error if configuration cannot be loaded or is invalid
Sourcepub fn get_default_config_paths() -> Vec<PathBuf>
pub fn get_default_config_paths() -> Vec<PathBuf>
Get the default configuration file paths to try
Sourcepub fn get_user_config_dir() -> PathBuf
pub fn get_user_config_dir() -> PathBuf
Get the user configuration directory
Sourcepub fn get_system_config_dir() -> PathBuf
pub fn get_system_config_dir() -> PathBuf
Get the system configuration directory
Sourcepub fn create_all_sample_configs() -> Result<()>
pub fn create_all_sample_configs() -> Result<()>
Create all default configuration files with sample content
§Errors
Returns an error if any file cannot be created
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigLoader
impl RefUnwindSafe for ConfigLoader
impl Send for ConfigLoader
impl Sync for ConfigLoader
impl Unpin 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