nginx: add basic auth support for locations
This commit is contained in:
parent
33cf4f0e8e
commit
c7bf3828f0
@ -290,6 +290,7 @@ let
|
|||||||
${optionalString (config.return != null) "return ${config.return};"}
|
${optionalString (config.return != null) "return ${config.return};"}
|
||||||
${config.extraConfig}
|
${config.extraConfig}
|
||||||
${optionalString (config.proxyPass != null && cfg.recommendedProxySettings) "include ${recommendedProxyConfig};"}
|
${optionalString (config.proxyPass != null && cfg.recommendedProxySettings) "include ${recommendedProxyConfig};"}
|
||||||
|
${mkBasicAuth "sublocation" config}
|
||||||
}
|
}
|
||||||
'') (sortProperties (mapAttrsToList (k: v: v // { location = k; }) locations)));
|
'') (sortProperties (mapAttrsToList (k: v: v // { location = k; }) locations)));
|
||||||
|
|
||||||
|
@ -9,6 +9,31 @@ with lib;
|
|||||||
|
|
||||||
{
|
{
|
||||||
options = {
|
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 {
|
proxyPass = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user