trustgraph/templates/util/decode-config.jsonnet
cybermaggedon 0ae6feddb0
Added GCP and Minikube output (#59)
* Added a config to create Minikube k8s, uses hostpath volumes
* Reworked templater to produce docker compose and minikube output
* Fix config templates
2024-09-09 17:16:50 +01:00

29 lines
640 B
Jsonnet

local components = import "components.jsonnet";
local apply = function(p, components)
local component = components[p.name];
(component + {
with:: function(k, v) self + {
[k]:: v
},
with_params:: function(pars)
self + std.foldl(
function(obj, par) obj.with(par.key, par.value),
std.objectKeysValues(pars),
self
),
}).with_params(p.parameters);
local decode = function(config)
local add = function(state, c) state + apply(c, components);
local patterns = std.foldl(add, config, {});
patterns;
decode