fix haproxy config generation tests
This commit is contained in:
parent
9246c03154
commit
a6eba63f5f
1 changed files with 7 additions and 27 deletions
|
@ -190,9 +190,7 @@ let
|
||||||
recursiveMerge = attrList:
|
recursiveMerge = attrList:
|
||||||
let f = attrPath:
|
let f = attrPath:
|
||||||
zipAttrsWith (n: values:
|
zipAttrsWith (n: values:
|
||||||
if tail values == [] then
|
if all isList values then
|
||||||
head values
|
|
||||||
else if all isList values then
|
|
||||||
concatLists values
|
concatLists values
|
||||||
else if all isAttrs values then
|
else if all isAttrs values then
|
||||||
f (attrPath ++ [n]) values
|
f (attrPath ++ [n]) values
|
||||||
|
@ -305,27 +303,15 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
http-response = [
|
http-response = {
|
||||||
''set-header Strict-Transport-Security "max-age=15552000; includeSubDomains; preload;"''
|
set-header = [
|
||||||
|
''Strict-Transport-Security "max-age=15552000; includeSubDomains; preload;"''
|
||||||
];
|
];
|
||||||
|
};
|
||||||
# acl = flatten (mapAttrsToList (name: config:
|
|
||||||
# assert assertHasAttr name ["frontend" "acl"] config;
|
|
||||||
# config.frontend.acl
|
|
||||||
# ) sites);
|
|
||||||
# use_backend = mapAttrsToList (name: config:
|
|
||||||
# assert assertHasAttr name ["frontend" "use_backend"] config;
|
|
||||||
# nameValuePair name config.frontend.use_backend
|
|
||||||
# ) sites;
|
|
||||||
}]
|
}]
|
||||||
++ (mapAttrsToList (name: config:
|
++ (mapAttrsToList (name: config:
|
||||||
assert assertHasAttr name ["frontend"] config;
|
assert assertHasAttr name ["frontend"] config;
|
||||||
#(filterAttrs (k: v: k != "use_backend" && k != "acl")
|
(updateByPath ["frontend" "use_backend"] (x: [(nameValuePair name x)]) config).frontend
|
||||||
# (mapAttrsRecursive
|
|
||||||
# (ks: v: optionalAttrs (hasAttrByPath ["frontend" "use_backend"] v) (setAttrByPath ["frontend" "use_backend"] (nameValuePair name v.frontend.use_backend)))
|
|
||||||
# config.frontend
|
|
||||||
(updateByPath ["frontend" "use_backend"] (x: (nameValuePair name x)) config).frontend
|
|
||||||
#)
|
|
||||||
) sites)
|
) sites)
|
||||||
++ (mapAttrsToList (name: config:
|
++ (mapAttrsToList (name: config:
|
||||||
if (hasAttr "debugHeaders" config && (getAttr "debugHeaders" config) != null) then {
|
if (hasAttr "debugHeaders" config && (getAttr "debugHeaders" config) != null) then {
|
||||||
|
@ -376,12 +362,6 @@ in
|
||||||
assert assertMsg (hasAttr "backend" config) "no backend defined in config for site ${name}, found attr names: ${toString (attrNames config)}";
|
assert assertMsg (hasAttr "backend" config) "no backend defined in config for site ${name}, found attr names: ${toString (attrNames config)}";
|
||||||
nameValuePair name config.backend)
|
nameValuePair name config.backend)
|
||||||
sites;
|
sites;
|
||||||
# inherit backend;
|
|
||||||
# backend =
|
|
||||||
# let
|
|
||||||
# b = backend: nameValuePair backend.name {inherit (backend) options;};
|
|
||||||
# in
|
|
||||||
# listToAttrs (flatten (map (s: mapAttrsToList b s.backends) sites));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# mapIfHasAttr = f: attr: set:
|
# mapIfHasAttr = f: attr: set:
|
||||||
|
|
Loading…
Add table
Reference in a new issue