1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

nginx: Assert that either root or alias is null.

If both are set, nginx won't start.  More error checking is certainly in
order, but this seems like a reasonable start.
This commit is contained in:
Evan Danaher 2017-03-09 13:02:49 -05:00
parent ff2e2e82cc
commit e7358b192a

View file

@ -380,6 +380,15 @@ in
config = mkIf cfg.enable {
# TODO: test user supplied config file pases syntax test
assertions = let hostOrAliasIsNull = l: l.root == null || l.alias == null; in [ {
assertion = all hostOrAliasIsNull (attrValues virtualHosts);
message = "Only one of nginx root or alias can be specified on a virtualHost.";
} {
assertion = all (host: all hostOrAliasIsNull (attrValues host.locations)) (attrValues virtualHosts);
message = "Only one of nginx root or alias can be specified on a location.";
}
];
systemd.services.nginx = {
description = "Nginx Web Server";
after = [ "network.target" ];