authelia: fix getUpstreamFromInstance

This commit is contained in:
NullBite 2024-07-18 17:11:06 -04:00
parent 9139163470
commit 9438fc6957
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A

View File

@ -24,16 +24,18 @@ let
instance:
let
inherit (config.services.authelia.instances.${instance}.settings) server;
inherit (server) port;
host =
if server.host == "0.0.0.0" then
port = server.port or 9091;
host = server.host or "127.0.0.1";
targetHost =
if host == "0.0.0.0" then
"127.0.0.1"
else if lib.hasInfix ":" server.host then
else if lib.hasInfix ":" host then
throw "TODO IPv6 not supported in Authelia server address (hard to parse, can't tell if it is [::])."
else
server.host;
host;
in
"http://${host}:${toString port}";
"http://${targetHost}:${toString port}";
# use this when reverse proxying to authelia (and only authelia because i
# like the nixos recommended proxy settings better)