meow
This commit is contained in:
@@ -1223,6 +1223,43 @@ rec {
|
||||
) (lib.attrValues autoStartTestContainers)
|
||||
);
|
||||
|
||||
exposedTcp = lib.mapAttrs (_: c: c.ports or [ ]) autoStartTestContainers;
|
||||
|
||||
hostAccessTcp = lib.filterAttrs (_: v: v != [ ]) (
|
||||
lib.mapAttrs (
|
||||
_: c: lib.concatMap (a: if a.to == "@host" then a.tcp or [ ] else [ ]) c.access
|
||||
) autoStartTestContainers
|
||||
);
|
||||
|
||||
pyForwardTcp = lib.concatStringsSep ", " (
|
||||
lib.concatMap (
|
||||
c:
|
||||
map (
|
||||
p:
|
||||
let
|
||||
np = normalizePort p;
|
||||
in
|
||||
"(${toString np.host}, \"${c.name}\", ${toString np.container})"
|
||||
) c.hostPorts
|
||||
) (lib.attrValues autoStartTestContainers)
|
||||
);
|
||||
|
||||
nginxBackendPorts = lib.mapAttrs (_: c: c.miscProperties.nginx.port) (
|
||||
lib.filterAttrs (
|
||||
_: c: c.miscProperties ? nginx && c.miscProperties.nginx ? port
|
||||
) autoStartTestContainers
|
||||
);
|
||||
|
||||
nginxDomainMap = lib.listToAttrs (
|
||||
lib.concatMap (
|
||||
c:
|
||||
lib.optional (c.miscProperties ? nginx && c.miscProperties.nginx ? domain) {
|
||||
name = c.miscProperties.nginx.domain;
|
||||
value = c.name;
|
||||
}
|
||||
) (lib.attrValues autoStartTestContainers)
|
||||
);
|
||||
|
||||
bin = lib.getExe';
|
||||
|
||||
testTools = [
|
||||
@@ -1330,6 +1367,12 @@ rec {
|
||||
# (src, to, tcp ports, udp ports); `to` may be "@host" or "@internet"
|
||||
EDGES = [${pyEdges}]
|
||||
|
||||
EXPOSED_TCP = ${pyDict pyInts exposedTcp}
|
||||
HOST_ACCESS_TCP = ${pyDict pyInts hostAccessTcp}
|
||||
FORWARD_TCP = [${pyForwardTcp}]
|
||||
NGINX_BACKENDS = ${pyDict toString nginxBackendPorts}
|
||||
NGINX_DOMAINS = ${pyDict pyStr nginxDomainMap}
|
||||
|
||||
NSENTER = "${bin pkgs.util-linux "nsenter"}"
|
||||
CURL = "${bin pkgs.curl "curl"}"
|
||||
IP = "${bin pkgs.iproute2 "ip"}"
|
||||
|
||||
Reference in New Issue
Block a user