From f3bebdff2837909179fe5610a41f56b0d5aa4b6c Mon Sep 17 00:00:00 2001 From: Lebedev Vadim Date: Fri, 11 Apr 2014 19:55:16 +0400 Subject: [PATCH] Added options to vhost: format_log location_custom_cfg_prepend location_custom_cfg_append --- manifests/resource/vhost.pp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/manifests/resource/vhost.pp b/manifests/resource/vhost.pp index fe0fdc9..d665789 100644 --- a/manifests/resource/vhost.pp +++ b/manifests/resource/vhost.pp @@ -162,6 +162,8 @@ define nginx::resource::vhost ( $location_custom_cfg = undef, $location_cfg_prepend = undef, $location_cfg_append = undef, + $location_custom_cfg_prepend = undef, + $location_custom_cfg_append = undef, $try_files = undef, $auth_basic = undef, $auth_basic_user_file = undef, @@ -170,6 +172,7 @@ define nginx::resource::vhost ( $include_files = undef, $access_log = undef, $error_log = undef, + $format_log = undef, $passenger_cgi_param = undef, $use_default_location = true, $rewrite_rules = [], @@ -336,13 +339,20 @@ define nginx::resource::vhost ( } } + # 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 # 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", default => $access_log, } + + $access_log_real = $format_log ? { + undef => $access_log_tmp, + default => "${access_log_tmp} $format_log", + } + $error_log_real = $error_log ? { undef => "${nginx::params::nx_logdir}/${name_sanitized}.error.log", default => $error_log, @@ -400,6 +410,16 @@ define nginx::resource::vhost ( 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']) { file { '/etc/nginx/fastcgi_params': ensure => present,