diff --git a/manifests/config.pp b/manifests/config.pp index 1410972..c563736 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -127,8 +127,11 @@ class nginx::config( } validate_bool($confd_purge) validate_bool($vhost_purge) - if ($proxy_cache_path != false) { - validate_string($proxy_cache_path) + if ( $proxy_cache_path != false) { + if ( is_string($proxy_cache_path) or is_hash($proxy_cache_path)) {} + else { + fail('proxy_cache_path must be a string or a hash') + } } validate_re($proxy_cache_levels, '^[12](:[12])*$') validate_string($proxy_cache_keys_zone) diff --git a/metadata.json b/metadata.json index 794609b..ff88bd2 100644 --- a/metadata.json +++ b/metadata.json @@ -10,7 +10,7 @@ "dependencies": [ {"name":"puppetlabs/stdlib","version_requirement":">= 4.2.0 <5.0.0"}, {"name":"puppetlabs/apt","version_requirement":">= 1.8.0 <3.0.0"}, - {"name":"puppetlabs/concat","version_requirement":">= 1.1.1 <2.0.0"} + {"name":"puppetlabs/concat","version_requirement":">= 1.1.1 <3.0.0"} ], "requirements": [ { diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index 5385bf0..d0e4bbc 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -116,9 +116,12 @@ http { <% if @proxy_headers_hash_bucket_size -%> proxy_headers_hash_bucket_size <%= @proxy_headers_hash_bucket_size %>; <% end -%> -<% if @proxy_cache_path -%> +<% if @proxy_cache_path.is_a?(Hash) -%> +<% @proxy_cache_path.sort_by{|k,v| k}.each do |key,value| -%> + proxy_cache_path <%= key %> keys_zone=<%= value %> levels=<%= @proxy_cache_levels %> max_size=<%= @proxy_cache_max_size %> inactive=<%= @proxy_cache_inactive %>; +<% end -%> +<% elsif @proxy_cache_path -%> proxy_cache_path <%= @proxy_cache_path %> levels=<%= @proxy_cache_levels %> keys_zone=<%= @proxy_cache_keys_zone %> max_size=<%= @proxy_cache_max_size %> inactive=<%= @proxy_cache_inactive %>; - <% end -%> <% if @fastcgi_cache_path -%> fastcgi_cache_path <%= @fastcgi_cache_path %> levels=<%= @fastcgi_cache_levels %> keys_zone=<%= @fastcgi_cache_keys_zone %> max_size=<%= @fastcgi_cache_max_size %> inactive=<%= @fastcgi_cache_inactive %>;