mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-11 07:15:54 +03:00
nixos/postgresql: improve the assertions for equality of DB user and DB name
It is hard to figure out which one is offending without the database name.
This commit is contained in:
parent
12797a6a39
commit
d57926c0b6
@ -455,19 +455,16 @@ in
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = all
|
||||
({ name, ensureDBOwnership, ... }: ensureDBOwnership -> builtins.elem name cfg.ensureDatabases)
|
||||
cfg.ensureUsers;
|
||||
message = ''
|
||||
For each database user defined with `services.postgresql.ensureUsers` and
|
||||
`ensureDBOwnership = true;`, a database with the same name must be defined
|
||||
in `services.postgresql.ensureDatabases`.
|
||||
'';
|
||||
}
|
||||
];
|
||||
assertions = map ({ name, ensureDBOwnership, ... }: {
|
||||
assertion = ensureDBOwnership -> builtins.elem name cfg.ensureDatabases;
|
||||
message = ''
|
||||
For each database user defined with `services.postgresql.ensureUsers` and
|
||||
`ensureDBOwnership = true;`, a database with the same name must be defined
|
||||
in `services.postgresql.ensureDatabases`.
|
||||
|
||||
Offender: ${name} has not been found among databases.
|
||||
'';
|
||||
}) cfg.ensureUsers;
|
||||
# `ensurePermissions` is now deprecated, let's avoid it.
|
||||
warnings = lib.optional (any ({ ensurePermissions, ... }: ensurePermissions != {}) cfg.ensureUsers) "
|
||||
`services.postgresql.*.ensurePermissions` is used in your expressions,
|
||||
|
Loading…
Reference in New Issue
Block a user