feat: add functions again

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-05-24 09:15:03 +02:00
parent 0d14152edf
commit f2e85f7114
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
3 changed files with 7 additions and 0 deletions

View File

@ -105,9 +105,14 @@ spec:
self: &std::sync::Arc<Self>, self: &std::sync::Arc<Self>,
key: &minijinja::Value, key: &minijinja::Value,
) -> Option<minijinja::Value> { ) -> Option<minijinja::Value> {
let name = self.name.clone();
let obj = match key.as_str()? { let obj = match key.as_str()? {
"name" => Value::from_safe_string(self.name.clone()), "name" => Value::from_safe_string(self.name.clone()),
"secrets" => Value::from_object(self.secrets.clone()), "secrets" => Value::from_object(self.secrets.clone()),
"has_values" => Value::from_serialize(!self.secrets.secrets.is_empty()),
"file_name" => Value::from_function(move |file_name: String| {
format!("{}-{}", file_name, name.replace("/", "-"))
}),
_ => return None, _ => return None,
}; };

View File

@ -0,0 +1 @@
nested

View File

@ -0,0 +1 @@
nested