MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / parse_promotion_config

Function parse_promotion_config

xtask/src/extension_catalog.rs:1004–1025  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

1002}
1003
1004fn parse_promotion_config(path: &Path) -> Result<BTreeMap<String, PromotionRequest>> {
1005 if !path.exists() {
1006 return Ok(BTreeMap::new());
1007 }
1008 let text = fs::read_to_string(path).with_context(|| format!("read {}", path.display()))?;
1009 let config: PromotionConfig =
1010 toml::from_str(&text).with_context(|| format!("parse {}", path.display()))?;
1011 ensure!(
1012 config.format_version == 1,
1013 "{} format_version must be 1",
1014 path.display()
1015 );
1016 let mut requests = BTreeMap::new();
1017 for request in config.extensions {
1018 ensure!(!request.id.is_empty(), "promotion request has empty id");
1019 ensure!(
1020 requests.insert(request.id.clone(), request).is_none(),
1021 "duplicate promotion request"
1022 );
1023 }
1024 Ok(requests)
1025}
1026
1027fn parse_smoke_config(path: &Path) -> Result<BTreeMap<String, ExtensionSmokeEvidence>> {
1028 if !path.exists() {

Callers 1

discover_catalogFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected