feat: no more recusion, simplified the function

This commit is contained in:
silver 2023-01-15 18:42:01 +00:00
parent badcfe1ada
commit 8f373ada01
2 changed files with 11 additions and 18 deletions

View file

@ -15,15 +15,16 @@
enable = true;
# gonna have to get all the
forward_parsed =
# merge together with a newline char
lib.strings.concatMapStrings (x: x + "\n") (
# merge the lists together
builtins.concatLists (
# using this function "(key: value: value.config.skynet_firewall.forward)" turn the values ointo a list
lib.attrsets.mapAttrsToList (key: value: value.config.skynet_firewall.forward) nodes
)
);
forward = builtins.concatLists (
# using this function "(key: value: value.config.skynet_firewall.forward)" turn the values ointo a list
lib.attrsets.mapAttrsToList (key: value:
# make sure that anything running this firewall dosent count (recursion otherewise)
# firewall may want to open ports in itself but can deal with that later
if value.config.skynet_firewall.enable
then []
else value.config.skynet_firewall.forward
) nodes
);
};
}