feat: prefer first variable

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-03-09 21:08:16 +01:00
parent 8520bcb5b0
commit 1d1ac49d0b
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394

View File

@ -151,12 +151,12 @@ fn filter_by_prefix(variables: Vec<CuddleVariable>) -> impl Function {
})
.collect::<Vec<CuddleVariable>>();
tracing::info!("was here");
let mut structure: HashMap<String, String> = HashMap::new();
for var in vars {
tracing::info!("found: {} - {}", &var.name, &var.value);
structure.insert(var.name, var.value);
if !structure.contains_key(&var.name) {
tracing::info!("found: {} - {}", &var.name, &var.value);
structure.insert(var.name, var.value);
}
}
Ok(serde_json::to_value(structure).unwrap())