Slightly tweak the config decode so that components can over-ride the

'with' method which injects parameters.
This commit is contained in:
Cyber MacGeddon 2024-11-05 21:05:28 +00:00
parent fc0af2f900
commit 76a3417b56

View file

@ -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);