Merge pull request #491

Resolves #391
This commit is contained in:
Matthew Haughton 2014-12-03 23:30:23 -05:00
commit 53c949a51d
4 changed files with 27 additions and 0 deletions

View file

@ -57,6 +57,7 @@ class nginx::config(
$http_tcp_nodelay = 'on',
$http_tcp_nopush = 'off',
$keepalive_timeout = '65',
$log_format = {},
$mail = false,
$multi_accept = 'off',
$names_hash_bucket_size = '64',

View file

@ -79,6 +79,7 @@ class nginx (
$global_group = undef,
$global_mode = undef,
$logdir = undef,
$log_format = undef,
$http_access_log = undef,
$nginx_error_log = undef,
$pid = undef,
@ -158,6 +159,7 @@ class nginx (
$http_tcp_nopush or
$keepalive_timeout or
$logdir or
$log_format or
$mail or
$multi_accept or
$names_hash_bucket_size or
@ -237,6 +239,7 @@ class nginx (
http_tcp_nopush => $http_tcp_nopush,
keepalive_timeout => $keepalive_timeout,
log_dir => $logdir,
log_format => $log_format,
mail => $mail,
multi_accept => $multi_accept,
names_hash_bucket_size => $names_hash_bucket_size,

View file

@ -177,6 +177,24 @@ describe 'nginx::config' do
:value => '100',
:match => ' worker_connections 100;',
},
{
:title => 'should set log formats',
:attr => 'log_format',
:value => {
'format1' => 'FORMAT1',
'format2' => 'FORMAT2',
},
:match => [
' log_format format1 \'FORMAT1\';',
' log_format format2 \'FORMAT2\';',
],
},
{
:title => 'should not set log formats',
:attr => 'log_format',
:value => {},
:notmatch => /log_format/,
},
{
:title => 'should set access_log',
:attr => 'http_access_log',

View file

@ -24,6 +24,11 @@ events {
http {
include <%= @conf_dir %>/mime.types;
default_type application/octet-stream;
<% if @log_format -%>
<% @log_format.sort_by{|k,v| k}.each do |key,value| -%>
log_format <%= key %> '<%= value %>';
<% end -%>
<% end -%>
access_log <%= @http_access_log %>;