public-access-proxy: prefer ip4 over ip6 for backends

ipv6 addresses change with mac addresses but our ipv4 addresses in
'serv' are static
This commit is contained in:
Astro 2021-10-07 17:52:20 +02:00
parent 883222a750
commit 16e19932e8
1 changed files with 3 additions and 3 deletions

View File

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