added streaming options.
This commit is contained in:
parent
d0f1f85e8e
commit
68a46d3ed1
3 changed files with 38 additions and 28 deletions
|
@ -80,6 +80,10 @@
|
|||
# [*priority*] - Location priority. Default: 500. User priority
|
||||
# 401-499, 501-599. If the priority is higher than the default priority,
|
||||
# the location will be defined after root, or before root.
|
||||
# [*mp4*] - Indicates whether or not this loation can be
|
||||
# used for mp4 streaming. Default: false
|
||||
# [*flv*] - Indicates whether or not this loation can be
|
||||
# used for flv streaming. Default: false
|
||||
#
|
||||
#
|
||||
# Actions:
|
||||
|
@ -163,7 +167,9 @@ define nginx::resource::location (
|
|||
$auth_basic = undef,
|
||||
$auth_basic_user_file = undef,
|
||||
$rewrite_rules = [],
|
||||
$priority = 500
|
||||
$priority = 500,
|
||||
$mp4 = false,
|
||||
$flv = false,
|
||||
) {
|
||||
|
||||
include nginx::params
|
||||
|
@ -303,7 +309,7 @@ define nginx::resource::location (
|
|||
if (($www_root != undef) and ($proxy != undef)) {
|
||||
fail('Cannot define both directory and proxy in a virtual host')
|
||||
}
|
||||
|
||||
|
||||
# fastcgi_script is deprecated
|
||||
if ($fastcgi_script != undef) {
|
||||
warning('The $fastcgi_script parameter is deprecated; please use $fastcgi_param instead to define custom fastcgi_params!')
|
||||
|
|
|
@ -54,6 +54,30 @@ describe 'nginx::resource::location' do
|
|||
:value => true,
|
||||
:match => ' internal;'
|
||||
},
|
||||
{
|
||||
:title => 'should not set mp4',
|
||||
:attr => 'mp4',
|
||||
:value => false,
|
||||
:notmatch => /mp4;/
|
||||
},
|
||||
{
|
||||
:title => 'should set mp4',
|
||||
:attr => 'mp4',
|
||||
:value => true,
|
||||
:match => ' mp4;'
|
||||
},
|
||||
{
|
||||
:title => 'should not set flv',
|
||||
:attr => 'flv',
|
||||
:value => false,
|
||||
:notmatch => /flv;/
|
||||
},
|
||||
{
|
||||
:title => 'should set flv',
|
||||
:attr => 'flv',
|
||||
:value => true,
|
||||
:match => ' flv;'
|
||||
},
|
||||
{
|
||||
:title => 'should set location_allow',
|
||||
:attr => 'location_allow',
|
||||
|
@ -470,32 +494,6 @@ describe 'nginx::resource::location' do
|
|||
without_content(/^[ ]+fastcgi_param\s+SCRIPT_FILENAME\s+.+?;/)
|
||||
end
|
||||
end
|
||||
|
||||
context "when fastcgi_param is {'CUSTOM_PARAM' => 'value'}" do
|
||||
let :params do default_params.merge({ :fastcgi_param => {'CUSTOM_PARAM' => 'value', 'CUSTOM_PARAM2' => 'value2'} }) end
|
||||
it "should set fastcgi_param" do
|
||||
should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).
|
||||
with_content(%r|fastcgi_param\s+CUSTOM_PARAM\s+value;|).
|
||||
with_content(%r|fastcgi_param\s+CUSTOM_PARAM2\s+value2;|)
|
||||
end
|
||||
it "should add comment # Enable custom fastcgi_params" do
|
||||
should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).
|
||||
with_content(%r|# Enable custom fastcgi_params\s+|)
|
||||
end
|
||||
end
|
||||
|
||||
context "when fastcgi_param is not set" do
|
||||
let :params do default_params end
|
||||
it "should not set fastcgi_param" do
|
||||
should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).
|
||||
without_content(/fastcgi_param\s+CUSTOM_PARAM\s+.+?;/).
|
||||
without_content(/fastcgi_param\s+CUSTOM_PARAM2\s+.+?;/)
|
||||
end
|
||||
it "should not add comment # Enable custom fastcgi_params" do
|
||||
should contain_concat__fragment(Digest::MD5.hexdigest("vhost1-500-#{params[:location]}")).
|
||||
without_content(/# Enable custom fastcgi_params\s+/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "vhost_location_proxy template content" do
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
<% if @internal -%>
|
||||
internal;
|
||||
<% end -%>
|
||||
<% if @mp4 -%>
|
||||
mp4;
|
||||
<% end -%>
|
||||
<% if @flv -%>
|
||||
flv;
|
||||
<% end -%>
|
||||
<% if @location_allow -%>
|
||||
<%- @location_allow.each do |allow_rule| -%>
|
||||
allow <%= allow_rule %>;
|
||||
|
|
Loading…
Reference in a new issue