mattermost: create role and db with postgres superuser
Recently, the postgres superuser name has changed. Using the configured and correct username here fixes database initialisation.
This commit is contained in:
parent
da93e6e678
commit
aeeac71231
@ -184,8 +184,10 @@ in
|
|||||||
fi
|
fi
|
||||||
'' + lib.optionalString cfg.localDatabaseCreate ''
|
'' + lib.optionalString cfg.localDatabaseCreate ''
|
||||||
if ! test -e "${cfg.statePath}/.db-created"; then
|
if ! test -e "${cfg.statePath}/.db-created"; then
|
||||||
|
${pkgs.sudo}/bin/sudo -u ${config.services.postgresql.superUser} \
|
||||||
${config.services.postgresql.package}/bin/psql postgres -c \
|
${config.services.postgresql.package}/bin/psql postgres -c \
|
||||||
"CREATE ROLE ${cfg.localDatabaseUser} WITH LOGIN NOCREATEDB NOCREATEROLE ENCRYPTED PASSWORD '${cfg.localDatabasePassword}'"
|
"CREATE ROLE ${cfg.localDatabaseUser} WITH LOGIN NOCREATEDB NOCREATEROLE ENCRYPTED PASSWORD '${cfg.localDatabasePassword}'"
|
||||||
|
${pkgs.sudo}/bin/sudo -u ${config.services.postgresql.superUser} \
|
||||||
${config.services.postgresql.package}/bin/createdb \
|
${config.services.postgresql.package}/bin/createdb \
|
||||||
--owner ${cfg.localDatabaseUser} ${cfg.localDatabaseName}
|
--owner ${cfg.localDatabaseUser} ${cfg.localDatabaseName}
|
||||||
touch ${cfg.statePath}/.db-created
|
touch ${cfg.statePath}/.db-created
|
||||||
|
Loading…
x
Reference in New Issue
Block a user