pub struct ConfigurationManager { /* private fields */ }Expand description
Configuration manager for loading and validating provider configuration
Implementations§
Source§impl ConfigurationManager
impl ConfigurationManager
Sourcepub fn load_with_precedence(&mut self) -> Result<(), ProviderError>
pub fn load_with_precedence(&mut self) -> Result<(), ProviderError>
Load configuration with proper precedence:
- Environment variables (highest priority)
- Project config (./.agent/config.yaml)
- Global config (~/Documents/.ricecoder/config.yaml)
- Built-in defaults (lowest priority)
Sourcepub fn get_global_config_path() -> PathBuf
pub fn get_global_config_path() -> PathBuf
Get the global configuration path
Sourcepub fn get_project_config_path() -> PathBuf
pub fn get_project_config_path() -> PathBuf
Get the project configuration path
Sourcepub fn load_from_env(&mut self) -> Result<(), ProviderError>
pub fn load_from_env(&mut self) -> Result<(), ProviderError>
Load configuration from environment variables (highest priority) Environment variables override any existing configuration
Sourcepub fn load_from_file(&mut self, path: &PathBuf) -> Result<(), ProviderError>
pub fn load_from_file(&mut self, path: &PathBuf) -> Result<(), ProviderError>
Load configuration from a YAML file (replaces current config)
Sourcepub fn merge_from_file(&mut self, path: &PathBuf) -> Result<(), ProviderError>
pub fn merge_from_file(&mut self, path: &PathBuf) -> Result<(), ProviderError>
Merge configuration from a YAML file (preserves existing config)
Sourcepub fn validate(&self) -> Result<(), ProviderError>
pub fn validate(&self) -> Result<(), ProviderError>
Validate the current configuration
Validates:
- At least one provider is configured
- Default provider exists in configuration
- API keys are present (from config or environment)
- Models are available for selected provider
- Context windows are reasonable
Sourcepub fn validate_with_registry(
&self,
registry: &ProviderRegistry,
) -> Result<(), ProviderError>
pub fn validate_with_registry( &self, registry: &ProviderRegistry, ) -> Result<(), ProviderError>
Validate configuration with provider registry (validates models are available)
This method requires a provider registry to validate that:
- Default model is available in the default provider
- Per-command models are available in their respective providers
- Per-action models are available in their respective providers
Sourcepub fn config(&self) -> &ProviderConfig
pub fn config(&self) -> &ProviderConfig
Get the current configuration
Sourcepub fn config_mut(&mut self) -> &mut ProviderConfig
pub fn config_mut(&mut self) -> &mut ProviderConfig
Get mutable configuration
Sourcepub fn default_provider(&self) -> &str
pub fn default_provider(&self) -> &str
Get the default provider ID
Sourcepub fn default_model(&self) -> &str
pub fn default_model(&self) -> &str
Get the default model ID
Sourcepub fn get_provider_settings(
&self,
provider_id: &str,
) -> Option<&ProviderSettings>
pub fn get_provider_settings( &self, provider_id: &str, ) -> Option<&ProviderSettings>
Get provider settings
Sourcepub fn get_api_key(&self, provider_id: &str) -> Result<String, ProviderError>
pub fn get_api_key(&self, provider_id: &str) -> Result<String, ProviderError>
Get API key for a provider (from config or environment)