add ability to designate location as internal
This commit is contained in:
parent
400e58a505
commit
9b14ba901e
3 changed files with 81 additions and 0 deletions
|
@ -5,6 +5,8 @@
|
|||
# Parameters:
|
||||
# [*ensure*] - Enables or disables the specified location
|
||||
# (present|absent)
|
||||
# [*internal*] - Indicates whether or not this loation can be
|
||||
# used for internal requests only. Default: false
|
||||
# [*vhost*] - Defines the default vHost for this location
|
||||
# entry to include with
|
||||
# [*location*] - Specifies the URI associated with this location
|
||||
|
@ -102,6 +104,7 @@
|
|||
|
||||
define nginx::resource::location (
|
||||
$ensure = present,
|
||||
$internal = false,
|
||||
$location = $name,
|
||||
$vhost = undef,
|
||||
$www_root = undef,
|
||||
|
@ -178,6 +181,9 @@ define nginx::resource::location (
|
|||
if ($fastcgi_split_path != undef) {
|
||||
validate_string($fastcgi_split_path)
|
||||
}
|
||||
|
||||
validate_bool($internal)
|
||||
|
||||
validate_bool($ssl)
|
||||
validate_bool($ssl_only)
|
||||
if ($location_alias != undef) {
|
||||
|
|
|
@ -42,6 +42,18 @@ describe 'nginx::resource::location' do
|
|||
:value => 'my_location',
|
||||
:match => ' location my_location {',
|
||||
},
|
||||
{
|
||||
:title => 'should not set internal',
|
||||
:attr => 'internal',
|
||||
:value => false,
|
||||
:notmatch => /internal;/
|
||||
},
|
||||
{
|
||||
:title => 'should set internal',
|
||||
:attr => 'internal',
|
||||
:value => true,
|
||||
:match => ' internal;'
|
||||
},
|
||||
{
|
||||
:title => 'should contain ordered prepended directives',
|
||||
:attr => 'location_cfg_prepend',
|
||||
|
@ -167,6 +179,18 @@ describe 'nginx::resource::location' do
|
|||
:value => 'my_location',
|
||||
:match => ' location my_location {',
|
||||
},
|
||||
{
|
||||
:title => 'should not set internal',
|
||||
:attr => 'internal',
|
||||
:value => false,
|
||||
:notmatch => /internal;/
|
||||
},
|
||||
{
|
||||
:title => 'should set internal',
|
||||
:attr => 'internal',
|
||||
:value => true,
|
||||
:match => ' internal;'
|
||||
},
|
||||
{
|
||||
:title => 'should contain ordered prepended directives',
|
||||
:attr => 'location_cfg_prepend',
|
||||
|
@ -230,6 +254,18 @@ describe 'nginx::resource::location' do
|
|||
:value => 'my_location',
|
||||
:match => ' location my_location {',
|
||||
},
|
||||
{
|
||||
:title => 'should not set internal',
|
||||
:attr => 'internal',
|
||||
:value => false,
|
||||
:notmatch => /internal;/
|
||||
},
|
||||
{
|
||||
:title => 'should set internal',
|
||||
:attr => 'internal',
|
||||
:value => true,
|
||||
:match => ' internal;'
|
||||
},
|
||||
{
|
||||
:title => 'should contain ordered prepended directives',
|
||||
:attr => 'location_cfg_prepend',
|
||||
|
@ -287,6 +323,18 @@ describe 'nginx::resource::location' do
|
|||
:value => 'my_location',
|
||||
:match => ' location my_location {',
|
||||
},
|
||||
{
|
||||
:title => 'should not set internal',
|
||||
:attr => 'internal',
|
||||
:value => false,
|
||||
:notmatch => /internal;/
|
||||
},
|
||||
{
|
||||
:title => 'should set internal',
|
||||
:attr => 'internal',
|
||||
:value => true,
|
||||
:match => ' internal;'
|
||||
},
|
||||
{
|
||||
:title => 'should contain ordered prepended directives',
|
||||
:attr => 'location_cfg_prepend',
|
||||
|
@ -380,6 +428,18 @@ describe 'nginx::resource::location' do
|
|||
:value => 'my_location',
|
||||
:match => ' location my_location {',
|
||||
},
|
||||
{
|
||||
:title => 'should not set internal',
|
||||
:attr => 'internal',
|
||||
:value => false,
|
||||
:notmatch => /internal;/
|
||||
},
|
||||
{
|
||||
:title => 'should set internal',
|
||||
:attr => 'internal',
|
||||
:value => true,
|
||||
:match => ' internal;'
|
||||
},
|
||||
{
|
||||
:title => 'should set the allow directive',
|
||||
:attr => 'location_allow',
|
||||
|
@ -499,6 +559,18 @@ describe 'nginx::resource::location' do
|
|||
:value => 'my_location',
|
||||
:match => ' location my_location {',
|
||||
},
|
||||
{
|
||||
:title => 'should not set internal',
|
||||
:attr => 'internal',
|
||||
:value => false,
|
||||
:notmatch => /internal;/
|
||||
},
|
||||
{
|
||||
:title => 'should set internal',
|
||||
:attr => 'internal',
|
||||
:value => true,
|
||||
:match => ' internal;'
|
||||
},
|
||||
{
|
||||
:title => 'should contain ordered config directives',
|
||||
:attr => 'location_custom_cfg',
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
location <%= @location %> {
|
||||
<% if @internal -%>
|
||||
internal;
|
||||
<% end -%>
|
||||
<% if @location_allow -%>
|
||||
<%- @location_allow.each do |allow_rule| -%>
|
||||
allow <%= allow_rule %>;
|
||||
|
|
Loading…
Reference in a new issue