Merge pull request #267906 from talyz/keycloak-hostname-url

nixos/keycloak: Allow setting `hostname-url`

authored by Kim Lindberger and committed by GitHub 9ec83042 d901c3c5

+11 -3
+11 -3
nixos/modules/services/web-apps/keycloak.nix
··· 25 25 maintainers 26 26 catAttrs 27 27 collect 28 - splitString 29 28 hasPrefix 30 29 ; 31 30 ··· 329 328 }; 330 329 331 330 hostname = mkOption { 332 - type = str; 331 + type = nullOr str; 332 + default = null; 333 333 example = "keycloak.example.com"; 334 334 description = lib.mdDoc '' 335 335 The hostname part of the public URL used as base for ··· 451 451 452 452 keycloakConfig = lib.generators.toKeyValue { 453 453 mkKeyValue = lib.flip lib.generators.mkKeyValueDefault "=" { 454 - mkValueString = v: with builtins; 454 + mkValueString = v: 455 455 if isInt v then toString v 456 456 else if isString v then v 457 457 else if true == v then "true" ··· 479 479 { 480 480 assertion = createLocalPostgreSQL -> config.services.postgresql.settings.standard_conforming_strings or true; 481 481 message = "Setting up a local PostgreSQL db for Keycloak requires `standard_conforming_strings` turned on to work reliably"; 482 + } 483 + { 484 + assertion = cfg.settings.hostname != null || cfg.settings.hostname-url or null != null; 485 + message = "Setting the Keycloak hostname is required, see `services.keycloak.settings.hostname`"; 486 + } 487 + { 488 + assertion = !(cfg.settings.hostname != null && cfg.settings.hostname-url or null != null); 489 + message = "`services.keycloak.settings.hostname` and `services.keycloak.settings.hostname-url` are mutually exclusive"; 482 490 } 483 491 ]; 484 492