pub struct SantaConfig {
pub sources: Vec<KnownSources>,
pub packages: Vec<String>,
pub custom_sources: Option<SourceList>,
pub _groups: Option<HashMap<KnownSources, Vec<String>>>,
pub log_level: u8,
}Expand description
Main configuration structure for Santa
Fields§
§sources: Vec<KnownSources>§packages: Vec<String>§custom_sources: Option<SourceList>§_groups: Option<HashMap<KnownSources, Vec<String>>>§log_level: u8Implementations§
Source§impl SantaConfig
impl SantaConfig
Sourcepub fn load_from_str(config_str: &str) -> Result<Self>
pub fn load_from_str(config_str: &str) -> Result<Self>
Load configuration from a string (CCL format)
§Example
use santa_data::config::SantaConfig;
let ccl = r#"
sources =
= brew
= cargo
packages =
= git
"#;
let config = SantaConfig::load_from_str(ccl).unwrap();
assert_eq!(config.sources.len(), 2);Sourcepub fn load_from(file: &Path) -> Result<Self>
pub fn load_from(file: &Path) -> Result<Self>
Load configuration from a file path
§Example
use santa_data::config::SantaConfig;
use std::path::Path;
let config = SantaConfig::load_from(Path::new("santa.ccl")).unwrap();Sourcepub fn validate_basic(&self) -> Result<()>
pub fn validate_basic(&self) -> Result<()>
Basic configuration validation
Checks for:
- At least one source is configured
- No duplicate sources
- Warns about duplicate packages
Trait Implementations§
Source§impl Clone for SantaConfig
impl Clone for SantaConfig
Source§fn clone(&self) -> SantaConfig
fn clone(&self) -> SantaConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SantaConfig
impl Debug for SantaConfig
Source§impl<'de> Deserialize<'de> for SantaConfig
impl<'de> Deserialize<'de> for SantaConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for SantaConfig
impl Serialize for SantaConfig
Source§impl Validate for SantaConfig
impl Validate for SantaConfig
Source§impl<'v_a> ValidateArgs<'v_a> for SantaConfig
impl<'v_a> ValidateArgs<'v_a> for SantaConfig
Auto Trait Implementations§
impl Freeze for SantaConfig
impl RefUnwindSafe for SantaConfig
impl Send for SantaConfig
impl Sync for SantaConfig
impl Unpin for SantaConfig
impl UnsafeUnpin for SantaConfig
impl UnwindSafe for SantaConfig
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