1
0
Fork 0

fix conflicting options in postgresql service

This commit is contained in:
ibizaman 2023-11-05 15:47:13 -08:00
parent 685133ba47
commit 77e16c0f76
2 changed files with 15 additions and 1 deletions

View file

@ -50,7 +50,7 @@ in
}; };
dbConfig = passwordCfgs: { dbConfig = passwordCfgs: {
services.postgresql.enable = (builtins.length passwordCfgs) > 0; services.postgresql.enable = lib.mkDefault ((builtins.length passwordCfgs) > 0);
services.postgresql.ensureDatabases = map ({ database, ... }: database) passwordCfgs; services.postgresql.ensureDatabases = map ({ database, ... }: database) passwordCfgs;
services.postgresql.ensureUsers = map ({ username, database, ... }: { services.postgresql.ensureUsers = map ({ username, database, ... }: {
name = username; name = username;

View file

@ -36,6 +36,20 @@ in
expr = testConfig {}; expr = testConfig {};
}; };
testPostgresManualOptions = {
expected = {
services.postgresql = {
enable = true;
ensureUsers = [];
ensureDatabases = [];
};
systemd.services.postgresql.postStart = "";
};
expr = testConfig {
services.postgresql.enable = true;
};
};
testPostgresOneWithoutPassword = { testPostgresOneWithoutPassword = {
expected = { expected = {
services.postgresql = { services.postgresql = {