diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 766d009e5..2992f69ec 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -34,6 +34,7 @@ regex = "1.7.1" rustix = { "version" = "0.38", features = ["thread", "fs", "system", "process"] } schemars = { version = "0.8.6", features = ["chrono"] } serde = { features = ["derive"], version = "1.0.125" } +serde_ignored = "0.1.9" serde_json = "1.0.64" serde_yaml = "0.9.17" serde_with = ">= 1.9.4, < 2" diff --git a/lib/src/install.rs b/lib/src/install.rs index 4972af6b7..f1a07e15e 100644 --- a/lib/src/install.rs +++ b/lib/src/install.rs @@ -413,8 +413,15 @@ pub(crate) mod config { let mut config: Option = None; for (_name, path) in fragments { let buf = std::fs::read_to_string(&path)?; - let c: InstallConfigurationToplevel = - toml::from_str(&buf).with_context(|| format!("Parsing {path:?}"))?; + let mut unused = std::collections::HashSet::new(); + let de = toml::Deserializer::new(&buf); + let c: InstallConfigurationToplevel = serde_ignored::deserialize(de, |path| { + unused.insert(path.to_string()); + }) + .with_context(|| format!("Parsing {path:?}"))?; + for key in unused { + eprintln!("warning: {path:?}: Unknown key {key}"); + } if let Some(config) = config.as_mut() { if let Some(install) = c.install { config.merge(install);