nginx: disallow alias directive on server level; it doesn't work.

This commit is contained in:
Evan Danaher 2017-03-09 16:54:44 -05:00
parent e7358b192a
commit a09246948c
2 changed files with 2 additions and 14 deletions

View File

@ -158,7 +158,6 @@ let
server_name ${serverName} ${concatStringsSep " " vhost.serverAliases}; server_name ${serverName} ${concatStringsSep " " vhost.serverAliases};
${acmeLocation} ${acmeLocation}
${optionalString (vhost.root != null) "root ${vhost.root};"} ${optionalString (vhost.root != null) "root ${vhost.root};"}
${optionalString (vhost.alias != null) "alias ${vhost.alias};"}
${optionalString (vhost.globalRedirect != null) '' ${optionalString (vhost.globalRedirect != null) ''
return 301 http${optionalString ssl "s"}://${vhost.globalRedirect}$request_uri; return 301 http${optionalString ssl "s"}://${vhost.globalRedirect}$request_uri;
''} ''}
@ -380,10 +379,8 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
# TODO: test user supplied config file pases syntax test # TODO: test user supplied config file pases syntax test
assertions = let hostOrAliasIsNull = l: l.root == null || l.alias == null; in [ { 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); assertion = all (host: all hostOrAliasIsNull (attrValues host.locations)) (attrValues virtualHosts);
message = "Only one of nginx root or alias can be specified on a location."; message = "Only one of nginx root or alias can be specified on a location.";
} }

View File

@ -89,15 +89,6 @@ with lib;
''; '';
}; };
alias = mkOption {
type = types.nullOr types.path;
default = null;
example = "/data/webserver/docs";
description = ''
The path of the web alias directory.
'';
};
default = mkOption { default = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;