From 402febc599b022dc64c430c8ce9ede504fc746b0 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 27 Apr 2014 09:49:45 -0400 Subject: [PATCH] Add fastcgi_cache_key and fastcgi_cache_use_stale parameters --- manifests/config.pp | 2 ++ manifests/init.pp | 10 ++++++++++ manifests/params.pp | 2 ++ templates/conf.d/nginx.conf.erb | 8 +++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 41587f1..b1a5466 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -31,6 +31,8 @@ class nginx::config( $fastcgi_cache_keys_zone = $nginx::params::nx_fastcgi_cache_keys_zone, $fastcgi_cache_max_size = $nginx::params::nx_fastcgi_cache_max_size, $fastcgi_cache_inactive = $nginx::params::nx_fastcgi_cache_inactive, + $fastcgi_cache_key = $nginx::params::nx_fastcgi_cache_key, + $fastcgi_cache_use_stale = $nginx::params::nx_fastcgi_cache_use_stale, $proxy_http_version = $nginx::params::nx_proxy_http_version, $names_hash_bucket_size = $nginx::params::nx_names_hash_bucket_size, $names_hash_max_size = $nginx::params::nx_names_hash_max_size, diff --git a/manifests/init.pp b/manifests/init.pp index db15a4c..8c18db3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -49,6 +49,8 @@ class nginx ( $fastcgi_cache_keys_zone = $nginx::params::nx_fastcgi_cache_keys_zone, $fastcgi_cache_max_size = $nginx::params::nx_fastcgi_cache_max_size, $fastcgi_cache_inactive = $nginx::params::nx_fastcgi_cache_inactive, + $fastcgi_cache_key = $nginx::params::nx_fastcgi_cache_key, + $fastcgi_cache_use_stale = $nginx::params::nx_fastcgi_cache_use_stale, $configtest_enable = $nginx::params::nx_configtest_enable, $service_restart = $nginx::params::nx_service_restart, $service_ensure = $nginx::params::nx_service_ensure, @@ -110,6 +112,12 @@ class nginx ( validate_string($fastcgi_cache_keys_zone) validate_string($fastcgi_cache_max_size) validate_string($fastcgi_cache_inactive) + if ($fastcgi_cache_key != false) { + validate_string($fastcgi_cache_key) + } + if ($fastcgi_cache_use_stale != false) { + validate_string($fastcgi_cache_use_stale) + } validate_bool($configtest_enable) validate_string($service_restart) @@ -159,6 +167,8 @@ class nginx ( fastcgi_cache_keys_zone => $fastcgi_cache_keys_zone, fastcgi_cache_max_size => $fastcgi_cache_max_size, fastcgi_cache_inactive => $fastcgi_cache_inactive, + fastcgi_cache_key => $fastcgi_cache_key, + fastcgi_cache_use_stale => $fastcgi_cache_use_stale, confd_purge => $confd_purge, vhost_purge => $vhost_purge, server_tokens => $server_tokens, diff --git a/manifests/params.pp b/manifests/params.pp index bab6aa8..94dd193 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -58,6 +58,8 @@ class nginx::params { $nx_fastcgi_cache_keys_zone = 'd3:100m' $nx_fastcgi_cache_max_size = '500m' $nx_fastcgi_cache_inactive = '20m' + $nx_fastcgi_cache_key = false + $nx_fastcgi_cache_use_stale = false $nx_client_body_temp_path = "${nx_run_dir}/client_body_temp" $nx_client_body_buffer_size = '128k' diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb index 925f419..f9de200 100644 --- a/templates/conf.d/nginx.conf.erb +++ b/templates/conf.d/nginx.conf.erb @@ -40,7 +40,13 @@ http { <% 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 %>; + 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 %>; +<% end -%> +<% if @fastcgi_cache_key -%> + fastcgi_cache_key <%= @fastcgi_cache_key %>; +<% end -%> +<% if @fastcgi_cache_use_stale -%> + fastcgi_cache_use_stale <%= @fastcgi_cache_use_stale %>; <% end -%> <% if @http_cfg_append -%><% @http_cfg_append.sort_by{|k,v| k}.each do |key,value| -%>