Add include files to locations

This commit is contained in:
cdenneen 2014-07-31 13:59:37 -04:00 committed by Matthew Haughton
parent 58d5c11cb8
commit 324179e7a4
3 changed files with 18 additions and 0 deletions

View file

@ -159,6 +159,7 @@ define nginx::resource::location (
$location_cfg_append = undef,
$location_custom_cfg_prepend = undef,
$location_custom_cfg_append = undef,
$include = undef,
$try_files = undef,
$proxy_cache = false,
$proxy_cache_valid = false,
@ -258,6 +259,9 @@ define nginx::resource::location (
if ($location_cfg_append != undef) {
validate_hash($location_cfg_append)
}
if ($include != undef) {
validate_array($include)
}
if ($try_files != undef) {
validate_array($try_files)
}

View file

@ -179,6 +179,15 @@ describe 'nginx::resource::location' do
' test3 subtest2 "sub test value2";',
],
},
{
:title => 'should contain include directives',
:attr => 'include',
:value => [ '/file1', '/file2' ],
:match => [
%r'^\s+include\s+/file1;',
%r'^\s+include\s+/file2;',
],
},
{
:title => 'should contain custom appended directives',
:attr => 'location_custom_cfg_append',

View file

@ -32,6 +32,11 @@
<%- Array(@raw_append).each do |line| -%>
<%= line %>
<%- end -%>
<% end -%>
<% if @include -%>
<% @include.each do |include_file| -%>
include <%= include_file %>;
<%- end -%>
<% end -%>
}