Add passenger_header parameter which deprecates passenger_cgi_param to support Passenger 5.0+
This commit is contained in:
parent
031fb9d896
commit
0aed6c1978
4 changed files with 37 additions and 0 deletions
|
@ -127,6 +127,8 @@
|
|||
# options like error level to the end.
|
||||
# [*passenger_cgi_param*] - Allows one to define additional CGI environment
|
||||
# variables to pass to the backend application
|
||||
# [*passenger_header*] - Allows one to set headers to pass to the
|
||||
# backend application (Passenger 5.0+)
|
||||
# [*log_by_lua*] - Run the Lua source code inlined as the
|
||||
# <lua-script-str> at the log request processing phase.
|
||||
# This does not replace the current access logs, but runs after.
|
||||
|
@ -227,6 +229,7 @@ define nginx::resource::vhost (
|
|||
$error_log = undef,
|
||||
$format_log = 'combined',
|
||||
$passenger_cgi_param = undef,
|
||||
$passenger_header = undef,
|
||||
$log_by_lua = undef,
|
||||
$log_by_lua_file = undef,
|
||||
$use_default_location = true,
|
||||
|
@ -408,6 +411,9 @@ define nginx::resource::vhost (
|
|||
if ($passenger_cgi_param != undef) {
|
||||
validate_hash($passenger_cgi_param)
|
||||
}
|
||||
if ($passenger_header != undef) {
|
||||
validate_hash($passenger_header)
|
||||
}
|
||||
if ($log_by_lua != undef) {
|
||||
validate_string($log_by_lua)
|
||||
}
|
||||
|
|
|
@ -853,6 +853,29 @@ describe 'nginx::resource::vhost' do
|
|||
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content( /passenger_set_cgi_param test3 test value 3;/ ) }
|
||||
end
|
||||
|
||||
context 'when passenger_header is set' do
|
||||
let :params do default_params.merge({
|
||||
:passenger_header => { 'test1' => 'test value 1', 'test2' => 'test value 2', 'test3' => 'test value 3' }
|
||||
}) end
|
||||
|
||||
it { is_expected.to contain_concat__fragment("#{title}-header").with_content( /passenger_set_header test1 test value 1;/ ) }
|
||||
it { is_expected.to contain_concat__fragment("#{title}-header").with_content( /passenger_set_header test2 test value 2;/ ) }
|
||||
it { is_expected.to contain_concat__fragment("#{title}-header").with_content( /passenger_set_header test3 test value 3;/ ) }
|
||||
end
|
||||
|
||||
context 'when passenger_header is set and ssl => true' do
|
||||
let :params do default_params.merge({
|
||||
:passenger_header => { 'test1' => 'test value 1', 'test2' => 'test value 2', 'test3' => 'test value 3' },
|
||||
:ssl => true,
|
||||
:ssl_key => 'dummy.key',
|
||||
:ssl_cert => 'dummy.cert',
|
||||
}) end
|
||||
|
||||
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content( /passenger_set_header test1 test value 1;/ ) }
|
||||
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content( /passenger_set_header test2 test value 2;/ ) }
|
||||
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content( /passenger_set_header test3 test value 3;/ ) }
|
||||
end
|
||||
|
||||
context 'when vhost name is sanitized' do
|
||||
let :title do 'www rspec-vhost com' end
|
||||
let :params do default_params end
|
||||
|
|
|
@ -94,6 +94,11 @@ server {
|
|||
passenger_set_cgi_param <%= key %> <%= @passenger_cgi_param[key] %>;
|
||||
<%- end -%>
|
||||
<% end -%>
|
||||
<% if @passenger_header -%>
|
||||
<%- @passenger_header.keys.sort.each do |key| -%>
|
||||
passenger_set_header <%= key %> <%= @passenger_header[key] %>;
|
||||
<%- end -%>
|
||||
<% end -%>
|
||||
<% if Array(@resolver).count > 0 -%>
|
||||
resolver <% Array(@resolver).each do |r| %> <%= r %><% end %>;
|
||||
<% end -%>
|
||||
|
|
|
@ -152,6 +152,9 @@ server {
|
|||
<% Array(@passenger_cgi_param).each do |key,value| -%>
|
||||
passenger_set_cgi_param <%= key %> <%= value %>;
|
||||
<% end -%>
|
||||
<% Array(@passenger_header).each do |key,value| -%>
|
||||
passenger_set_header <%= key %> <%= value %>;
|
||||
<% end -%>
|
||||
<% Array(@add_header).each do |key,value| -%>
|
||||
add_header <%= key %> <%= value %>;
|
||||
<% end -%>
|
||||
|
|
Loading…
Reference in a new issue