mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nginx: add basic auth support for locations
This commit is contained in:
parent
33cf4f0e8e
commit
c7bf3828f0
2 changed files with 26 additions and 0 deletions
|
@ -290,6 +290,7 @@ let
|
|||
${optionalString (config.return != null) "return ${config.return};"}
|
||||
${config.extraConfig}
|
||||
${optionalString (config.proxyPass != null && cfg.recommendedProxySettings) "include ${recommendedProxyConfig};"}
|
||||
${mkBasicAuth "sublocation" config}
|
||||
}
|
||||
'') (sortProperties (mapAttrsToList (k: v: v // { location = k; }) locations)));
|
||||
|
||||
|
|
|
@ -9,6 +9,31 @@ with lib;
|
|||
|
||||
{
|
||||
options = {
|
||||
basicAuth = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
example = literalExample ''
|
||||
{
|
||||
user = "password";
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Basic Auth protection for a vhost.
|
||||
|
||||
WARNING: This is implemented to store the password in plain text in the
|
||||
nix store.
|
||||
'';
|
||||
};
|
||||
|
||||
basicAuthFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
description = ''
|
||||
Basic Auth password file for a vhost.
|
||||
Can be created via: <command>htpasswd -c <filename> <username></command>
|
||||
'';
|
||||
};
|
||||
|
||||
proxyPass = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue