Load and parse config from a specific path
(path: &Path)
| 12 | impl ProjectConfig { |
| 13 | /// Load and parse config from a specific path |
| 14 | pub(crate) fn load_from_path(path: &Path) -> Result<Self> { |
| 15 | let config_content = fs::read(path) |
| 16 | .with_context(|| format!("Failed to read config file at {}", path.display()))?; |
| 17 | |
| 18 | let config: Self = serde_yaml::from_slice(&config_content).with_context(|| { |
| 19 | format!( |
| 20 | "Failed to parse CodSpeed project config at {}", |
| 21 | path.display() |
| 22 | ) |
| 23 | })?; |
| 24 | |
| 25 | // Validate the config |
| 26 | config.validate()?; |
| 27 | |
| 28 | Ok(config) |
| 29 | } |
| 30 | |
| 31 | /// Validate the configuration |
| 32 | /// |