Skip to content

Commit

Permalink
nixos/kanidm: allow not setting bindaddress
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDaG committed Nov 4, 2024
1 parent a33f82f commit 8fa3b1f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions nixos/modules/services/security/kanidm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,19 @@ let
'';

serverPort =
let
address = cfg.serverSettings.bindaddress;
in
# ipv6:
if hasInfix "]:" cfg.serverSettings.bindaddress then
last (splitString "]:" cfg.serverSettings.bindaddress)
if hasInfix "]:" address then
last (splitString "]:" address)
else
# ipv4:
if hasInfix "." cfg.serverSettings.bindaddress then
last (splitString ":" cfg.serverSettings.bindaddress)
if hasInfix "." address then
last (splitString ":" address)
# default is 8443
else
"8443";
throw "Address not parseable as IPv4 nor IPv6.";
in
{
options.services.kanidm = {
Expand All @@ -225,6 +228,7 @@ in
bindaddress = mkOption {
description = "Address/port combination the webserver binds to.";
example = "[::1]:8443";
default = "127.0.0.1:8443";
type = types.str;
};
# Should be optional but toml does not accept null
Expand Down

0 comments on commit 8fa3b1f

Please sign in to comment.