Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/keycloak: add realmImportsDirectory config #206729

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions nixos/modules/services/web-apps/keycloak.nix
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,21 @@ in
'';
};

realmImportsDirectory = mkOption {
type = lib.types.nullOr lib.types.path;
example = "/run/keycloak/data/import/";
default = null;
description = lib.mdDoc ''
A directory of realm json file configurations.

Each file in this directory should contain a single realm
configuration. Only regular files using the name
`{realm-name}-realm.json` are read from this directory,
sub-directories are ignored. If a realm already exists in
the server, it is overriden.
'';
};

themes = mkOption {
type = attrsOf package;
default = { };
Expand Down Expand Up @@ -661,6 +676,9 @@ in
'' + ''
export KEYCLOAK_ADMIN=admin
export KEYCLOAK_ADMIN_PASSWORD=${escapeShellArg cfg.initialAdminPassword}
'' + optionalString (cfg.realmImportsDirectory != null) ''
kc.sh import --dir ${cfg.realmImportsDirectory} --override true || true
'' + ''
kc.sh start --optimized
'';
};
Expand Down