Skip to content

Commit

Permalink
nixos/redmine: Fix database assertions
Browse files Browse the repository at this point in the history
Recent PR 266270[1] modified an assertion related to database settings
of the redmine service. There are two problems with that change:

1. Assert message was not updated to reflect the change in the assert
   condition.

2. The new condition applies only to postgresql, not the default
   mysql. Therefore, the assertion breaks existing mysql-based
   installations without any reason.

This commit fixes these by 1) reverting the modified assertion to the
previous value, making the message match the condition and 2) adding a
new assertion that applies only to postgresql.

[1]: NixOS#266270
  • Loading branch information
wentasah authored and dansbandit committed Dec 27, 2023
1 parent 22d18a8 commit 9c4fb73
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nixos/modules/services/misc/redmine.nix
Expand Up @@ -264,9 +264,12 @@ in
{ assertion = cfg.database.passwordFile != null || cfg.database.socket != null;
message = "one of services.redmine.database.socket or services.redmine.database.passwordFile must be set";
}
{ assertion = cfg.database.createLocally -> cfg.database.user == cfg.user && cfg.database.user == cfg.database.name;
{ assertion = cfg.database.createLocally -> cfg.database.user == cfg.user;
message = "services.redmine.database.user must be set to ${cfg.user} if services.redmine.database.createLocally is set true";
}
{ assertion = pgsqlLocal -> cfg.database.user == cfg.database.name;
message = "services.redmine.database.user and services.redmine.database.name must be the same when using a local postgresql database";
}
{ assertion = cfg.database.createLocally -> cfg.database.socket != null;
message = "services.redmine.database.socket must be set if services.redmine.database.createLocally is set to true";
}
Expand Down

0 comments on commit 9c4fb73

Please sign in to comment.