Skip to content

Commit

Permalink
Merge pull request voxpupuli#326 from janorn/proxy_conf
Browse files Browse the repository at this point in the history
Make proxy variables configurable via hiera
  • Loading branch information
James Fryman committed Jun 4, 2014
2 parents c287616 + 8613a52 commit 47a5bea
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
4 changes: 4 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
# This class file is not called directly
class nginx::config(
$client_body_buffer_size = $nginx::params::nx_client_body_buffer_size,
$client_max_body_size = $nginx::params::nx_client_max_body_size,
$confd_purge = $nginx::params::nx_confd_purge,
$conf_template = $nginx::params::nx_conf_template,
Expand All @@ -40,9 +41,12 @@
$proxy_cache_max_size = $nginx::params::nx_proxy_cache_max_size,
$proxy_cache_path = $nginx::params::nx_proxy_cache_path,
$proxy_conf_template = $nginx::params::nx_proxy_conf_template,
$proxy_connect_timeout = $nginx::params::nx_proxy_connect_timeout,
$proxy_headers_hash_bucket_size = $nginx::params::nx_proxy_headers_hash_bucket_size,
$proxy_http_version = $nginx::params::nx_proxy_http_version,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$proxy_redirect = $nginx::params::nx_proxy_redirect,
$proxy_send_timeout = $nginx::params::nx_proxy_send_timeout,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$server_tokens = $nginx::params::nx_server_tokens,
$types_hash_bucket_size = $nginx::params::nx_types_hash_bucket_size,
Expand Down
8 changes: 8 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# include nginx
# }
class nginx (
$client_body_buffer_size = $nginx::params::nx_client_body_buffer_size,
$client_max_body_size = $nginx::params::nx_client_max_body_size,
$confd_purge = $nginx::params::nx_confd_purge,
$configtest_enable = $nginx::params::nx_configtest_enable,
Expand Down Expand Up @@ -65,9 +66,12 @@
$proxy_cache_max_size = $nginx::params::nx_proxy_cache_max_size,
$proxy_cache_path = $nginx::params::nx_proxy_cache_path,
$proxy_conf_template = $nginx::params::nx_proxy_conf_template,
$proxy_connect_timeout = $nginx::params::nx_proxy_connect_timeout,
$proxy_headers_hash_bucket_size = $nginx::params::nx_proxy_headers_hash_bucket_size,
$proxy_http_version = $nginx::params::nx_proxy_http_version,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$proxy_redirect = $nginx::params::nx_proxy_redirect,
$proxy_send_timeout = $nginx::params::nx_proxy_send_timeout,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$server_tokens = $nginx::params::nx_server_tokens,
$service_ensure = $nginx::params::nx_service_ensure,
Expand Down Expand Up @@ -160,6 +164,7 @@
}

class { 'nginx::config':
client_body_buffer_size => $client_body_buffer_size,
client_max_body_size => $client_max_body_size,
confd_purge => $confd_purge,
conf_template => $conf_template,
Expand All @@ -186,9 +191,12 @@
proxy_cache_max_size => $proxy_cache_max_size,
proxy_cache_path => $proxy_cache_path,
proxy_conf_template => $proxy_conf_template,
proxy_connect_timeout => $proxy_connect_timeout,
proxy_headers_hash_bucket_size => $proxy_headers_hash_bucket_size,
proxy_http_version => $proxy_http_version,
proxy_read_timeout => $proxy_read_timeout,
proxy_redirect => $proxy_redirect,
proxy_send_timeout => $proxy_send_timeout,
proxy_set_header => $proxy_set_header,
server_tokens => $server_tokens,
vhost_purge => $vhost_purge,
Expand Down
8 changes: 4 additions & 4 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@
'index.htm',
'index.php'],
$proxy = undef,
$proxy_redirect = $nginx::params::nx_proxy_redirect,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$proxy_connect_timeout = $nginx::params::nx_proxy_connect_timeout,
$proxy_set_header = $nginx::params::nx_proxy_set_header,
$proxy_redirect = $nginx::config::proxy_redirect,
$proxy_read_timeout = $nginx::config::proxy_read_timeout,
$proxy_connect_timeout = $nginx::config::proxy_connect_timeout,
$proxy_set_header = $nginx::config::proxy_set_header,
$fastcgi = undef,
$fastcgi_params = '/etc/nginx/fastcgi_params',
$fastcgi_script = undef,
Expand Down
4 changes: 2 additions & 2 deletions manifests/resource/vhost.pp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
$ssl_trusted_cert = undef,
$spdy = $nginx::params::nx_spdy,
$proxy = undef,
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
$proxy_connect_timeout = $nginx::params::nx_proxy_connect_timeout,
$proxy_read_timeout = $nginx::config::proxy_read_timeout,
$proxy_connect_timeout = $nginx::config::proxy_connect_timeout,
$proxy_set_header = [],
$proxy_cache = false,
$proxy_cache_valid = false,
Expand Down
8 changes: 4 additions & 4 deletions templates/conf.d/proxy.conf.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
proxy_redirect <%= @proxy_redirect %>;
client_max_body_size <%= @client_max_body_size %>;
client_body_buffer_size <%= scope.lookupvar('nginx::params::nx_client_body_buffer_size') %>;
proxy_connect_timeout <%= scope.lookupvar('nginx::params::nx_proxy_connect_timeout') %>;
proxy_send_timeout <%= scope.lookupvar('nginx::params::nx_proxy_send_timeout') %>;
proxy_read_timeout <%= scope.lookupvar('nginx::params::nx_proxy_read_timeout') %>;
client_body_buffer_size <%= @client_body_buffer_size %>;
proxy_connect_timeout <%= @proxy_connect_timeout %>;
proxy_send_timeout <%= @proxy_send_timeout %>;
proxy_read_timeout <%= @proxy_read_timeout %>;
proxy_buffers <%= @proxy_buffers %>;
proxy_buffer_size <%= @proxy_buffer_size %>;
proxy_http_version <%= @proxy_http_version %>;
Expand Down

0 comments on commit 47a5bea

Please sign in to comment.