Moved worker_connections, worker_process and proxy_set_header to the new structure, backwards compatible

Defaults are set inside params, nginx class will set default and send it from local var to nginx::config,
so even when there is no need for set default values on nginx::config, in case someone already using
this module it's for some reason calling directly nginx::config, to avoid breaking anything defaults are
set inside nginx::config too.
This commit is contained in:
Guzmán Brasó 2012-09-28 13:59:32 -03:00
parent af166a9ac5
commit e1363545ae
4 changed files with 18 additions and 7 deletions

View file

@ -13,7 +13,11 @@
# Sample Usage:
#
# This class file is not called directly
class nginx::config inherits nginx::params {
class nginx::config(
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header
) inherits nginx::params {
File {
owner => 'root',
group => 'root',

View file

@ -28,7 +28,11 @@
# node default {
# include nginx
# }
class nginx {
class nginx (
$worker_processes = $nginx::params::nx_worker_processes,
$worker_connections = $nginx::params::nx_worker_connections,
$proxy_set_header = $nginx::params::nx_proxy_set_header
) inherits nginx::params {
include stdlib
@ -37,8 +41,11 @@ class nginx {
}
class { 'nginx::config':
require => Class['nginx::package'],
notify => Class['nginx::service'],
worker_processes => $worker_processes,
worker_connections => $worker_connections,
proxy_set_header => $proxy_set_header,
require => Class['nginx::package'],
notify => Class['nginx::service'],
}
class { 'nginx::service': }

View file

@ -1,11 +1,11 @@
user <%= scope.lookupvar('nginx::config::nx_daemon_user') %>;
worker_processes <%= scope.lookupvar('nginx::params::nx_worker_processes')%>;
worker_processes <%= worker_processes %>;
error_log <%= scope.lookupvar('nginx::params::nx_logdir')%>/error.log;
pid <%= scope.lookupvar('nginx::params::nx_pid')%>;
events {
worker_connections <%= scope.lookupvar('nginx::params::nx_worker_connections') %>;
worker_connections <%= worker_connections %>;
<% if scope.lookupvar('nginx::params::nx_multi_accept') == 'on' %>multi_accept on;<% end %>
}

View file

@ -5,6 +5,6 @@ proxy_connect_timeout <%= scope.lookupvar('nginx::params::nx_proxy_connect_tim
proxy_send_timeout <%= scope.lookupvar('nginx::params::nx_proxy_send_timeout') %>;
proxy_read_timeout <%= scope.lookupvar('nginx::params::nx_proxy_read_timeout') %>;
proxy_buffers <%= scope.lookupvar('nginx::params::nx_proxy_buffers') %>;
<% scope.lookupvar('nginx::params::nx_proxy_set_header').each do |header| %>
<% proxy_set_header.each do |header| %>
proxy_set_header <%= header %>;
<% end %>