Skip to content

Commit 7d44318

Browse files
committed
Remove custom template env remnants
These were added to test overriding the minijinja `default` None handling. Gating in the template was easier, and so this is not needed now. Signed-off-by: Robert Detjens <[email protected]>
1 parent 86ba328 commit 7d44318

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/deploy/kubernetes/templates.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use minijinja::{context, escape_formatter, Environment, Value};
2-
31
// Embed Kubernetes template files into binary.
42

53
pub static CHALLENGE_NAMESPACE: &str =
@@ -13,33 +11,3 @@ pub static CHALLENGE_SERVICE_HTTP: &str =
1311

1412
pub static CHALLENGE_SERVICE_TCP: &str =
1513
include_str!("../../asset_files/challenge_templates/tcp.yaml.j2");
16-
17-
/// Build template environment with None as default
18-
/// https://github.com/mitsuhiko/minijinja/tree/main/examples/none-as-undefined
19-
pub fn template_env() -> Environment<'static> {
20-
let mut env = Environment::new();
21-
22-
env.add_filter("default", none_default);
23-
env.set_formatter(|out, state, value| {
24-
escape_formatter(
25-
out,
26-
state,
27-
if value.is_none() {
28-
&Value::UNDEFINED
29-
} else {
30-
value
31-
},
32-
)
33-
});
34-
35-
env
36-
}
37-
38-
/// Similar to the regular `default` filter but also handles `none`.
39-
pub fn none_default(value: Value, other: Option<Value>) -> Value {
40-
if value.is_undefined() || value.is_none() {
41-
other.unwrap_or_else(|| Value::from(""))
42-
} else {
43-
value
44-
}
45-
}

0 commit comments

Comments
 (0)