Refactor templates (#52)

* Switching from docker compose to abstract form - should be easier to k8s later
* Text loader util
* Recreate templates
This commit is contained in:
cybermaggedon 2024-09-05 16:40:47 +01:00 committed by GitHub
parent af5508ff68
commit 65d7f6d261
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 1659 additions and 1277 deletions

View file

@ -0,0 +1,29 @@
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