public-access-proxy: catch ip4/ip6==null

This commit is contained in:
Astro 2022-02-18 23:07:55 +01:00
parent 67f4d6196a
commit f10328915c
1 changed files with 4 additions and 4 deletions

View File

@ -54,10 +54,10 @@
) (builtins.attrNames nixosConfig.services.nginx.virtualHosts)
);
proxyTo.host =
if config.c3d2.hosts."${host}" ? ip4
then config.c3d2.hosts."${host}".ip4
else if config.c3d2.hosts."${host}" ? ip6
then "[${config.c3d2.hosts."${host}".ip6}]"
if config.c3d2.hosts.${host} ? ip4 && config.c3d2.hosts.${host}.ip4 != null
then config.c3d2.hosts.${host}.ip4
else if config.c3d2.hosts.${host} ? ip6 && config.c3d2.hosts.${host}.ip6 != null
then "[${config.c3d2.hosts.${host}.ip6}]"
else throw "No known addresses for ${host}";
}
) (builtins.attrNames (