Add passenger_env_var parameter which deprecates passenger_cgi_param to support Passenger 5.0+
This commit is contained in:
parent
0aed6c1978
commit
d0464923d1
4 changed files with 37 additions and 0 deletions
|
@ -129,6 +129,8 @@
|
||||||
# variables to pass to the backend application
|
# variables to pass to the backend application
|
||||||
# [*passenger_header*] - Allows one to set headers to pass to the
|
# [*passenger_header*] - Allows one to set headers to pass to the
|
||||||
# backend application (Passenger 5.0+)
|
# backend application (Passenger 5.0+)
|
||||||
|
# [*passenger_env_var*] - Allows one to set environemnt variables to pass
|
||||||
|
# to the backend application (Passenger 5.0+)
|
||||||
# [*log_by_lua*] - Run the Lua source code inlined as the
|
# [*log_by_lua*] - Run the Lua source code inlined as the
|
||||||
# <lua-script-str> at the log request processing phase.
|
# <lua-script-str> at the log request processing phase.
|
||||||
# This does not replace the current access logs, but runs after.
|
# This does not replace the current access logs, but runs after.
|
||||||
|
@ -230,6 +232,7 @@ define nginx::resource::vhost (
|
||||||
$format_log = 'combined',
|
$format_log = 'combined',
|
||||||
$passenger_cgi_param = undef,
|
$passenger_cgi_param = undef,
|
||||||
$passenger_header = undef,
|
$passenger_header = undef,
|
||||||
|
$passenger_env_var = undef,
|
||||||
$log_by_lua = undef,
|
$log_by_lua = undef,
|
||||||
$log_by_lua_file = undef,
|
$log_by_lua_file = undef,
|
||||||
$use_default_location = true,
|
$use_default_location = true,
|
||||||
|
@ -414,6 +417,9 @@ define nginx::resource::vhost (
|
||||||
if ($passenger_header != undef) {
|
if ($passenger_header != undef) {
|
||||||
validate_hash($passenger_header)
|
validate_hash($passenger_header)
|
||||||
}
|
}
|
||||||
|
if ($passenger_env_var != undef) {
|
||||||
|
validate_hash($passenger_env_var)
|
||||||
|
}
|
||||||
if ($log_by_lua != undef) {
|
if ($log_by_lua != undef) {
|
||||||
validate_string($log_by_lua)
|
validate_string($log_by_lua)
|
||||||
}
|
}
|
||||||
|
|
|
@ -876,6 +876,29 @@ describe 'nginx::resource::vhost' do
|
||||||
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content( /passenger_set_header test3 test value 3;/ ) }
|
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content( /passenger_set_header test3 test value 3;/ ) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when passenger_env_var is set' do
|
||||||
|
let :params do default_params.merge({
|
||||||
|
:passenger_env_var => { '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_env_var test1 test value 1;/ ) }
|
||||||
|
it { is_expected.to contain_concat__fragment("#{title}-header").with_content( /passenger_set_env_var test2 test value 2;/ ) }
|
||||||
|
it { is_expected.to contain_concat__fragment("#{title}-header").with_content( /passenger_set_env_var test3 test value 3;/ ) }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when passenger_env_var is set and ssl => true' do
|
||||||
|
let :params do default_params.merge({
|
||||||
|
:passenger_env_var => { '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_env_var test1 test value 1;/ ) }
|
||||||
|
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content( /passenger_set_env_var test2 test value 2;/ ) }
|
||||||
|
it { is_expected.to contain_concat__fragment("#{title}-ssl-header").with_content( /passenger_set_env_var test3 test value 3;/ ) }
|
||||||
|
end
|
||||||
|
|
||||||
context 'when vhost name is sanitized' do
|
context 'when vhost name is sanitized' do
|
||||||
let :title do 'www rspec-vhost com' end
|
let :title do 'www rspec-vhost com' end
|
||||||
let :params do default_params end
|
let :params do default_params end
|
||||||
|
|
|
@ -99,6 +99,11 @@ server {
|
||||||
passenger_set_header <%= key %> <%= @passenger_header[key] %>;
|
passenger_set_header <%= key %> <%= @passenger_header[key] %>;
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
<% if @passenger_env_var -%>
|
||||||
|
<%- @passenger_env_var.keys.sort.each do |key| -%>
|
||||||
|
passenger_set_env_var <%= key %> <%= @passenger_env_var[key] %>;
|
||||||
|
<%- end -%>
|
||||||
|
<% end -%>
|
||||||
<% if Array(@resolver).count > 0 -%>
|
<% if Array(@resolver).count > 0 -%>
|
||||||
resolver <% Array(@resolver).each do |r| %> <%= r %><% end %>;
|
resolver <% Array(@resolver).each do |r| %> <%= r %><% end %>;
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
|
@ -155,6 +155,9 @@ server {
|
||||||
<% Array(@passenger_header).each do |key,value| -%>
|
<% Array(@passenger_header).each do |key,value| -%>
|
||||||
passenger_set_header <%= key %> <%= value %>;
|
passenger_set_header <%= key %> <%= value %>;
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
<% Array(@passenger_env_var).each do |key,value| -%>
|
||||||
|
passenger_set_env_var <%= key %> <%= value %>;
|
||||||
|
<% end -%>
|
||||||
<% Array(@add_header).each do |key,value| -%>
|
<% Array(@add_header).each do |key,value| -%>
|
||||||
add_header <%= key %> <%= value %>;
|
add_header <%= key %> <%= value %>;
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
Loading…
Reference in a new issue