fix: gracefully handle the config option not existing
This commit is contained in:
parent
ea493b434b
commit
1378338bb2
2 changed files with 21 additions and 9 deletions
|
@ -72,9 +72,13 @@ in {
|
||||||
lib.attrsets.mapAttrsToList (key: value:
|
lib.attrsets.mapAttrsToList (key: value:
|
||||||
# make sure that anything running this firewall dosent count (recursion otherewise)
|
# 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
|
# firewall may want to open ports in itself but can deal with that later
|
||||||
if value.config.skynet_firewall.enable
|
if builtins.hasAttr "skynet_firewall" value.config
|
||||||
then []
|
then (
|
||||||
else value.config.skynet_firewall.forward
|
if value.config.skynet_firewall.enable
|
||||||
|
then []
|
||||||
|
else value.config.skynet_firewall.forward
|
||||||
|
)
|
||||||
|
else []
|
||||||
) nodes
|
) nodes
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -46,17 +46,25 @@ in {
|
||||||
# using the same logic as the firewall, comments there
|
# using the same logic as the firewall, comments there
|
||||||
external = builtins.concatLists (
|
external = builtins.concatLists (
|
||||||
lib.attrsets.mapAttrsToList (key: value:
|
lib.attrsets.mapAttrsToList (key: value:
|
||||||
if value.config.deployment.hostname == hostname
|
if builtins.hasAttr "skynet_dns" value.config
|
||||||
then own.external
|
then (
|
||||||
else value.config.skynet_dns.records.external
|
if value.config.deployment.targetHost == hostname
|
||||||
|
then own.external
|
||||||
|
else value.config.skynet_dns.records.external
|
||||||
|
)
|
||||||
|
else []
|
||||||
) nodes
|
) nodes
|
||||||
);
|
);
|
||||||
|
|
||||||
cname = builtins.concatLists (
|
cname = builtins.concatLists (
|
||||||
lib.attrsets.mapAttrsToList (key: value:
|
lib.attrsets.mapAttrsToList (key: value:
|
||||||
if value.config.deployment.hostname == hostname
|
if builtins.hasAttr "skynet_dns" value.config
|
||||||
then own.cname
|
then (
|
||||||
else value.config.skynet_dns.records.cname
|
if value.config.deployment.targetHost == hostname
|
||||||
|
then own.cname
|
||||||
|
else value.config.skynet_dns.records.cname
|
||||||
|
)
|
||||||
|
else []
|
||||||
) nodes
|
) nodes
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue