nginx module: add resolver config

This commit is contained in:
Robin Gloster 2017-04-15 15:09:18 +02:00
parent 75bbcd4215
commit 94a2cba8d9
No known key found for this signature in database
GPG key ID: 5E4C836C632C2882

View file

@ -38,6 +38,10 @@ let
include ${cfg.package}/conf/fastcgi.conf;
include ${cfg.package}/conf/uwsgi_params;
${optionalString (cfg.resolver.addresses != []) ''
resolver ${toString cfg.resolver.addresses} ${optionalString (cfg.resolver.valid != "") "valid=${cfg.resolver.valid}"};
''}
${optionalString (cfg.recommendedOptimisation) ''
# optimisation
sendfile on;
@ -385,6 +389,32 @@ in
description = "Path to DH parameters file.";
};
resolver = mkOption {
type = types.submodule {
options = {
addresses = mkOption {
type = types.listOf types.str;
default = [];
example = literalExample ''[ "[::1]" "127.0.0.1:5353" ]'';
description = "List of resolvers to use";
};
valid = mkOption {
type = types.str;
default = "";
example = "30s";
description = ''
By default, nginx caches answers using the TTL value of a response.
An optional valid parameter allows overriding it
'';
};
};
};
description = ''
Configures name servers used to resolve names of upstream servers into addresses
'';
default = {};
};
virtualHosts = mkOption {
type = types.attrsOf (types.submodule (import ./vhost-options.nix {
inherit config lib;