pub struct ConfigManager;Expand description
Configuration manager for loading and saving config
Implementations§
Source§impl ConfigManager
impl ConfigManager
Sourcepub fn config_path() -> CarpResult<PathBuf>
pub fn config_path() -> CarpResult<PathBuf>
Get the path to the config file
Sourcepub fn load() -> CarpResult<Config>
pub fn load() -> CarpResult<Config>
Load configuration from file, creating default if it doesn’t exist
Sourcepub fn save(config: &Config) -> CarpResult<()>
pub fn save(config: &Config) -> CarpResult<()>
Save configuration to file
Sourcepub fn set_api_key(api_key: String) -> CarpResult<()>
pub fn set_api_key(api_key: String) -> CarpResult<()>
Update the API key in the config
Sourcepub fn clear_api_key() -> CarpResult<()>
pub fn clear_api_key() -> CarpResult<()>
Clear the API key from the config
Sourcepub fn set_api_token(token: String) -> CarpResult<()>
👎Deprecated: Use set_api_key instead
pub fn set_api_token(token: String) -> CarpResult<()>
Legacy method for backward compatibility
Sourcepub fn clear_api_token() -> CarpResult<()>
👎Deprecated: Use clear_api_key instead
pub fn clear_api_token() -> CarpResult<()>
Legacy method for backward compatibility
Sourcepub fn cache_dir() -> CarpResult<PathBuf>
pub fn cache_dir() -> CarpResult<PathBuf>
Get the cache directory for storing downloaded agents
Sourcepub fn load_with_env_checks() -> CarpResult<Config>
pub fn load_with_env_checks() -> CarpResult<Config>
Get configuration with runtime environment checks
Sourcepub fn validate_api_key(api_key: &str) -> CarpResult<()>
pub fn validate_api_key(api_key: &str) -> CarpResult<()>
Validate API key format and basic security checks
Sourcepub fn set_api_key_secure(api_key: String) -> CarpResult<()>
pub fn set_api_key_secure(api_key: String) -> CarpResult<()>
Securely update API key with validation
Sourcepub fn set_api_token_secure(token: String) -> CarpResult<()>
👎Deprecated: Use set_api_key_secure instead
pub fn set_api_token_secure(token: String) -> CarpResult<()>
Legacy method for backward compatibility
Sourcepub fn export_template() -> CarpResult<String>
pub fn export_template() -> CarpResult<String>
Export configuration template for deployment
Sourcepub fn validate_config_file(path: &PathBuf) -> CarpResult<()>
pub fn validate_config_file(path: &PathBuf) -> CarpResult<()>
Validate configuration file without loading sensitive data
Auto Trait Implementations§
impl Freeze for ConfigManager
impl RefUnwindSafe for ConfigManager
impl Send for ConfigManager
impl Sync for ConfigManager
impl Unpin for ConfigManager
impl UnwindSafe for ConfigManager
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