hosts/plover: update Keycloak service config

This commit is contained in:
Gabriel Arazas 2023-02-09 18:10:46 +08:00
parent b1427c1c9f
commit 5ba2b6d846
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -62,12 +62,14 @@ in
# Modifying it a little bit for per-user schema.
systemd.services.keycloak = {
path = [ config.services.postgresql.package ];
preStart = lib.mkAfter ''
# Setting up the appropriate schema for PostgreSQL secure schema usage.
psql -tAc "SELECT 1 FROM information_schema.schemata WHERE schema_name='${keycloakUser}';" \
| grep -q 1 || psql -tAc "CREATE SCHEMA IF NOT EXISTS AUTHORIZATION ${keycloakUser};"
'';
preStart = let
psqlBin = "${lib.getBin config.services.postgresql.package}/bin/psql";
in
lib.mkAfter ''
# Setting up the appropriate schema for PostgreSQL secure schema usage.
${psqlBin} -tAc "SELECT 1 FROM information_schema.schemata WHERE schema_name='${keycloakUser}';" \
| grep -q 1 || psql -tAc "CREATE SCHEMA IF NOT EXISTS AUTHORIZATION ${keycloakUser};"
'';
};
# Attaching it to the reverse proxy of choice.