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