Merge pull request #295 from abraham1901/dev
Fix cert sanitized and add some options
This commit is contained in:
commit
8218c59d70
6 changed files with 42 additions and 20 deletions
|
@ -146,6 +146,7 @@ define nginx::resource::vhost (
|
||||||
$spdy = $nginx::params::nx_spdy,
|
$spdy = $nginx::params::nx_spdy,
|
||||||
$proxy = undef,
|
$proxy = undef,
|
||||||
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
|
$proxy_read_timeout = $nginx::params::nx_proxy_read_timeout,
|
||||||
|
$proxy_connect_timeout = $nginx::params::nx_proxy_connect_timeout,
|
||||||
$proxy_set_header = [],
|
$proxy_set_header = [],
|
||||||
$proxy_cache = false,
|
$proxy_cache = false,
|
||||||
$proxy_cache_valid = false,
|
$proxy_cache_valid = false,
|
||||||
|
@ -167,6 +168,8 @@ define nginx::resource::vhost (
|
||||||
$location_custom_cfg = undef,
|
$location_custom_cfg = undef,
|
||||||
$location_cfg_prepend = undef,
|
$location_cfg_prepend = undef,
|
||||||
$location_cfg_append = undef,
|
$location_cfg_append = undef,
|
||||||
|
$location_custom_cfg_prepend = undef,
|
||||||
|
$location_custom_cfg_append = undef,
|
||||||
$try_files = undef,
|
$try_files = undef,
|
||||||
$auth_basic = undef,
|
$auth_basic = undef,
|
||||||
$auth_basic_user_file = undef,
|
$auth_basic_user_file = undef,
|
||||||
|
@ -178,6 +181,7 @@ define nginx::resource::vhost (
|
||||||
$include_files = undef,
|
$include_files = undef,
|
||||||
$access_log = undef,
|
$access_log = undef,
|
||||||
$error_log = undef,
|
$error_log = undef,
|
||||||
|
$format_log = undef,
|
||||||
$passenger_cgi_param = undef,
|
$passenger_cgi_param = undef,
|
||||||
$use_default_location = true,
|
$use_default_location = true,
|
||||||
$rewrite_rules = [],
|
$rewrite_rules = [],
|
||||||
|
@ -348,13 +352,20 @@ define nginx::resource::vhost (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# This was a lot to add up in parameter list so add it down here
|
# This was a lot to add up in parameter list so add it down here
|
||||||
# Also opted to add more logic here and keep template cleaner which
|
# Also opted to add more logic here and keep template cleaner which
|
||||||
# unfortunately means resorting to the $varname_real thing
|
# unfortunately means resorting to the $varname_real thing
|
||||||
$access_log_real = $access_log ? {
|
$access_log_tmp = $access_log ? {
|
||||||
undef => "${nginx::params::nx_logdir}/${name_sanitized}.access.log",
|
undef => "${nginx::params::nx_logdir}/${name_sanitized}.access.log",
|
||||||
default => $access_log,
|
default => $access_log,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$access_log_real = $format_log ? {
|
||||||
|
undef => $access_log_tmp,
|
||||||
|
default => "${access_log_tmp} $format_log",
|
||||||
|
}
|
||||||
|
|
||||||
$error_log_real = $error_log ? {
|
$error_log_real = $error_log ? {
|
||||||
undef => "${nginx::params::nx_logdir}/${name_sanitized}.error.log",
|
undef => "${nginx::params::nx_logdir}/${name_sanitized}.error.log",
|
||||||
default => $error_log,
|
default => $error_log,
|
||||||
|
@ -381,6 +392,7 @@ define nginx::resource::vhost (
|
||||||
location_deny => $location_deny,
|
location_deny => $location_deny,
|
||||||
proxy => $proxy,
|
proxy => $proxy,
|
||||||
proxy_read_timeout => $proxy_read_timeout,
|
proxy_read_timeout => $proxy_read_timeout,
|
||||||
|
proxy_connect_timeout => $proxy_connect_timeout,
|
||||||
proxy_cache => $proxy_cache,
|
proxy_cache => $proxy_cache,
|
||||||
proxy_cache_valid => $proxy_cache_valid,
|
proxy_cache_valid => $proxy_cache_valid,
|
||||||
proxy_method => $proxy_method,
|
proxy_method => $proxy_method,
|
||||||
|
@ -412,6 +424,16 @@ define nginx::resource::vhost (
|
||||||
location_cfg_append => $location_cfg_append }
|
location_cfg_append => $location_cfg_append }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $location_custom_cfg_prepend {
|
||||||
|
Nginx::Resource::Location["${name_sanitized}-default"] {
|
||||||
|
location_custom_cfg_prepend => $location_custom_cfg_prepend }
|
||||||
|
}
|
||||||
|
|
||||||
|
if $location_custom_cfg_append {
|
||||||
|
Nginx::Resource::Location["${name_sanitized}-default"] {
|
||||||
|
location_custom_cfg_append => $location_custom_cfg_append }
|
||||||
|
}
|
||||||
|
|
||||||
if $fastcgi != undef and !defined(File['/etc/nginx/fastcgi_params']) {
|
if $fastcgi != undef and !defined(File['/etc/nginx/fastcgi_params']) {
|
||||||
file { '/etc/nginx/fastcgi_params':
|
file { '/etc/nginx/fastcgi_params':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
|
@ -463,7 +485,7 @@ define nginx::resource::vhost (
|
||||||
}
|
}
|
||||||
|
|
||||||
#Generate ssl key/cert with provided file-locations
|
#Generate ssl key/cert with provided file-locations
|
||||||
$cert = regsubst($name,' ','_')
|
$cert = regsubst($name,' ','_', 'G')
|
||||||
|
|
||||||
# Check if the file has been defined before creating the file to
|
# Check if the file has been defined before creating the file to
|
||||||
# avoid the error when using wildcard cert on the multiple vhosts
|
# avoid the error when using wildcard cert on the multiple vhosts
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
|
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
|
||||||
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
||||||
<% Array(subvalue).each do |asubvalue| -%>
|
<% Array(subvalue).each do |asubvalue| -%>
|
||||||
<%= key %> <%= subkey %> <%= asubvalue %>;
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% else -%>
|
<% end -%><% else -%>
|
||||||
<% Array(value).each do |asubvalue| -%>
|
<% Array(value).each do |asubvalue| -%>
|
||||||
<%= key %> <%= asubvalue %>;
|
<%= key %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% end -%>
|
<% end -%><% end -%>
|
||||||
|
@ -36,11 +36,11 @@
|
||||||
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
||||||
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
||||||
<% Array(subvalue).each do |asubvalue| -%>
|
<% Array(subvalue).each do |asubvalue| -%>
|
||||||
<%= key %> <%= subkey %> <%= asubvalue %>;
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% else -%>
|
<% end -%><% else -%>
|
||||||
<% Array(value).each do |asubvalue| -%>
|
<% Array(value).each do |asubvalue| -%>
|
||||||
<%= key %> <%= asubvalue %>;
|
<%= key %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% end -%>
|
<% end -%><% end -%>
|
||||||
|
|
|
@ -54,11 +54,11 @@
|
||||||
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
||||||
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
||||||
<% Array(subvalue).each do |asubvalue| -%>
|
<% Array(subvalue).each do |asubvalue| -%>
|
||||||
<%= key %> <%= subkey %> <%= asubvalue %>;
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% else -%>
|
<% end -%><% else -%>
|
||||||
<% Array(value).each do |asubvalue| -%>
|
<% Array(value).each do |asubvalue| -%>
|
||||||
<%= key %> <%= asubvalue %>;
|
<%= key %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% end -%>
|
<% end -%><% end -%>
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
|
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
|
||||||
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
||||||
<% Array(subvalue).each do |asubvalue| -%>
|
<% Array(subvalue).each do |asubvalue| -%>
|
||||||
<%= key %> <%= subkey %> <%= asubvalue %>;
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% else -%>
|
<% end -%><% else -%>
|
||||||
<% Array(value).each do |asubvalue| -%>
|
<% Array(value).each do |asubvalue| -%>
|
||||||
<%= key %> <%= asubvalue %>;
|
<%= key %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% end -%>
|
<% end -%><% end -%>
|
||||||
|
@ -55,11 +55,11 @@
|
||||||
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
||||||
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
||||||
<% Array(subvalue).each do |asubvalue| -%>
|
<% Array(subvalue).each do |asubvalue| -%>
|
||||||
<%= key %> <%= subkey %> <%= asubvalue %>;
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% else -%>
|
<% end -%><% else -%>
|
||||||
<% Array(value).each do |asubvalue| -%>
|
<% Array(value).each do |asubvalue| -%>
|
||||||
<%= key %> <%= asubvalue %>;
|
<%= key %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% end -%>
|
<% end -%><% end -%>
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
|
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
|
||||||
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
||||||
<% Array(subvalue).each do |asubvalue| -%>
|
<% Array(subvalue).each do |asubvalue| -%>
|
||||||
<%= key %> <%= subkey %> <%= asubvalue %>;
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% else -%>
|
<% end -%><% else -%>
|
||||||
<% Array(value).each do |asubvalue| -%>
|
<% Array(value).each do |asubvalue| -%>
|
||||||
<%= key %> <%= asubvalue %>;
|
<%= key %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% end -%>
|
<% end -%><% end -%>
|
||||||
|
@ -61,11 +61,11 @@
|
||||||
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
||||||
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
||||||
<% Array(subvalue).each do |asubvalue| -%>
|
<% Array(subvalue).each do |asubvalue| -%>
|
||||||
<%= key %> <%= subkey %> <%= asubvalue %>;
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% else -%>
|
<% end -%><% else -%>
|
||||||
<% Array(value).each do |asubvalue| -%>
|
<% Array(value).each do |asubvalue| -%>
|
||||||
<%= key %> <%= asubvalue %>;
|
<%= key %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% end -%>
|
<% end -%><% end -%>
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
|
<% if @location_custom_cfg_prepend -%><% @location_custom_cfg_prepend.each do |key,value| -%>
|
||||||
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
||||||
<% Array(subvalue).each do |asubvalue| -%>
|
<% Array(subvalue).each do |asubvalue| -%>
|
||||||
<%= key %> <%= subkey %> <%= asubvalue %>;
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% else -%>
|
<% end -%><% else -%>
|
||||||
<% Array(value).each do |asubvalue| -%>
|
<% Array(value).each do |asubvalue| -%>
|
||||||
<%= key %> <%= asubvalue %>;
|
<%= key %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% end -%>
|
<% end -%><% end -%>
|
||||||
|
@ -36,11 +36,11 @@
|
||||||
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
<% if @location_custom_cfg_append -%><% @location_custom_cfg_append.each do |key,value| -%>
|
||||||
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
<% if value.is_a?(Hash) -%><% value.each do |subkey,subvalue| -%>
|
||||||
<% Array(subvalue).each do |asubvalue| -%>
|
<% Array(subvalue).each do |asubvalue| -%>
|
||||||
<%= key %> <%= subkey %> <%= asubvalue %>;
|
<%= key %> <%= subkey %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% else -%>
|
<% end -%><% else -%>
|
||||||
<% Array(value).each do |asubvalue| -%>
|
<% Array(value).each do |asubvalue| -%>
|
||||||
<%= key %> <%= asubvalue %>;
|
<%= key %> <%= asubvalue %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% end -%><% end -%>
|
<% end -%><% end -%>
|
||||||
|
|
Loading…
Reference in a new issue