config/set: provide the "primary" layer

Summary: Provide the ConfigSet content as a layer so it can be inspected.

Reviewed By: muirdm

Differential Revision: D56592490

fbshipit-source-id: d443f85c477568e6bf5210e9dc8a96bd2ed6a0c4
This commit is contained in:
Jun Wu 2024-04-29 13:21:09 -07:00 committed by Facebook GitHub Bot
parent 2b248450d2
commit 385c056c48

View File

@ -198,7 +198,14 @@ impl Config for ConfigSet {
fn layers(&self) -> Vec<Arc<dyn Config>> {
if let Some(secondary) = &self.secondary {
secondary.layers()
let mut layers = secondary.layers();
if !self.sections.is_empty() {
// PERF: This clone can be slow.
let mut primary = self.clone().named("primary");
primary.secondary = None;
layers.push(Arc::new(primary))
}
layers
} else {
Vec::new()
}