From 76a3417b568f2556ff66a8daa0dedbf705afaf53 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Tue, 5 Nov 2024 21:05:28 +0000 Subject: [PATCH] Slightly tweak the config decode so that components can over-ride the 'with' method which injects parameters. --- templates/util/decode-config.jsonnet | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/util/decode-config.jsonnet b/templates/util/decode-config.jsonnet index a1bd146e..503b5b6b 100644 --- a/templates/util/decode-config.jsonnet +++ b/templates/util/decode-config.jsonnet @@ -3,9 +3,7 @@ local components = import "components.jsonnet"; local apply = function(p, components) - local component = components[p.name]; - - (component + { + local base = { with:: function(k, v) self + { [k]:: v @@ -18,7 +16,11 @@ local apply = function(p, components) self ), - }).with_params(p.parameters); + }; + + local component = base + components[p.name]; + + component.with_params(p.parameters); local decode = function(config) local add = function(state, c) state + apply(c, components);