diff --git a/keycloak/mkunit.nix b/keycloak/mkunit.nix index 8641fd8..150b681 100644 --- a/keycloak/mkunit.nix +++ b/keycloak/mkunit.nix @@ -7,6 +7,7 @@ , group , dbPasswordFile , postgresServiceName +, initialAdminUsername ? "admin" , initialAdminFile ? null , dependsOn ? {} @@ -14,10 +15,12 @@ { inherit name configDir configFile; + inherit initialAdminUsername; + pkg = KeycloakService { inherit configDir configFile; inherit user group; - inherit dbPasswordFile initialAdminFile; + inherit dbPasswordFile initialAdminUsername initialAdminFile; inherit postgresServiceName; }; diff --git a/keycloak/unit.nix b/keycloak/unit.nix index ffc0d2a..eacd94a 100644 --- a/keycloak/unit.nix +++ b/keycloak/unit.nix @@ -10,6 +10,7 @@ , dbType ? "postgres" , dbPasswordFile , postgresServiceName +, initialAdminUsername ? null , initialAdminFile ? null }: { ... }: @@ -39,6 +40,7 @@ utils.systemd.mkService rec { Group=${group} EnvironmentFile=${dbPasswordFile} + ${if initialAdminFile != null then "Environment=KEYCLOAK_ADMIN="+initialAdminUsername else ""} ${if initialAdminFile != null then "EnvironmentFile="+initialAdminFile else ""} Environment=PATH=${pkgs.coreutils}/bin Environment=KC_HOME_DIR="/run/keycloak"