From 5a4f6069f999104b0dfbc2759b86454afdc6058b Mon Sep 17 00:00:00 2001 From: Simon Stier Date: Thu, 28 Jul 2016 17:17:55 +0200 Subject: [PATCH] Add use_temp_path into proxy_cache_path see http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path --- manifests/config.pp | 5 +++++ manifests/init.pp | 3 +++ templates/conf.d/nginx.conf.erb | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 7b59b1b..9d14867 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -82,6 +82,7 @@ class nginx::config( $proxy_cache_levels = '1', $proxy_cache_max_size = '500m', $proxy_cache_path = false, + $proxy_use_temp_path = false, $proxy_connect_timeout = '90', $proxy_headers_hash_bucket_size = '64', $proxy_http_version = undef, @@ -143,6 +144,10 @@ class nginx::config( validate_string($proxy_cache_max_size) validate_string($proxy_cache_inactive) + if ($proxy_use_temp_path != false) { + validate_re($proxy_use_temp_path, '^(on|off)$') + } + if ($fastcgi_cache_path != false) { validate_string($fastcgi_cache_path) } diff --git a/manifests/init.pp b/manifests/init.pp index f3dd656..ab8aa62 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -54,6 +54,7 @@ class nginx ( $proxy_cache_levels = undef, $proxy_cache_max_size = undef, $proxy_cache_path = undef, + $proxy_use_temp_path = undef, $proxy_connect_timeout = undef, $proxy_headers_hash_bucket_size = undef, $proxy_http_version = undef, @@ -178,6 +179,7 @@ class nginx ( $proxy_cache_levels or $proxy_cache_max_size or $proxy_cache_path or + $proxy_use_temp_path or $proxy_conf_template or $proxy_connect_timeout or $proxy_headers_hash_bucket_size or @@ -260,6 +262,7 @@ class nginx ( proxy_cache_levels => $proxy_cache_levels, proxy_cache_max_size => $proxy_cache_max_size, proxy_cache_path => $proxy_cache_path, + proxy_use_temp_path => $proxy_use_temp_path, proxy_conf_template => $proxy_conf_template, proxy_connect_timeout => $proxy_connect_timeout, proxy_headers_hash_bucket_size => $proxy_headers_hash_bucket_size, diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index 826707e..9b8368d 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -128,10 +128,10 @@ http { <% end -%> <% 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 %>; + proxy_cache_path <%= key %> keys_zone=<%= value %> levels=<%= @proxy_cache_levels %> max_size=<%= @proxy_cache_max_size %> inactive=<%= @proxy_cache_inactive %><% if @proxy_use_temp_path %> use_temp_path=<%= @proxy_use_temp_path %><% end -%>; <% 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 %>; + 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 %><% if @proxy_use_temp_path %> use_temp_path=<%= @proxy_use_temp_path %><% end %>; <% 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 %>;