removing proxy_cache_path_hash from nginx::config and adding validation for either
has or string for proxy_cache_path made the conditional test to use is_a?(Hash) for simplicity's sake in templates/conf.d/nginx.conf.erb
This commit is contained in:
parent
4d93e049ca
commit
3b21779bfc
2 changed files with 6 additions and 7 deletions
|
@ -69,7 +69,6 @@ class nginx::config(
|
|||
$proxy_cache_keys_zone = 'd2:100m',
|
||||
$proxy_cache_levels = '1',
|
||||
$proxy_cache_max_size = '500m',
|
||||
$proxy_cache_path_hash = 'string',
|
||||
$proxy_cache_path = false,
|
||||
$proxy_connect_timeout = '90',
|
||||
$proxy_headers_hash_bucket_size = '64',
|
||||
|
@ -114,11 +113,11 @@ class nginx::config(
|
|||
}
|
||||
validate_bool($confd_purge)
|
||||
validate_bool($vhost_purge)
|
||||
if ($proxy_cache_path_hash != 'string') {
|
||||
validate_hash($proxy_cache_path)
|
||||
}
|
||||
elsif ($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)
|
||||
|
|
|
@ -64,7 +64,7 @@ http {
|
|||
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
|
||||
|
||||
<% end -%>
|
||||
<% if @proxy_cache_path_hash != 'string' -%>
|
||||
<% 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 -%>
|
||||
|
|
Loading…
Reference in a new issue