Skip to content

Commit

Permalink
Merge pull request #637 from jacobmw/proxy_cache_path
Browse files Browse the repository at this point in the history
Multiple proxy_cache_path entries
  • Loading branch information
jfryman committed Nov 30, 2015
2 parents c728f8c + 3b21779 commit 0e930e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@
}
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)
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand Down
7 changes: 5 additions & 2 deletions templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>;
Expand Down

0 comments on commit 0e930e9

Please sign in to comment.