Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple values in gzip_proxied parameter #1578

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ Default value: `'1.1'`

##### <a name="-nginx--gzip_proxied"></a>`gzip_proxied`

Data type: `Nginx::GzipProxied`
Data type: `Variant[Nginx::GzipProxied, Array[Nginx::GzipProxied]]`



Expand Down
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
String $gzip_disable = 'msie6',
Integer $gzip_min_length = 20,
Variant[Enum['1.0','1.1'], Float] $gzip_http_version = '1.1',
Nginx::GzipProxied $gzip_proxied = 'off',
Variant[Nginx::GzipProxied, Array[Nginx::GzipProxied]] $gzip_proxied = 'off',
Optional[Variant[String[1],Array[String[1]]]] $gzip_types = undef,
Enum['on', 'off'] $gzip_vary = 'off',
Optional[Enum['on', 'off', 'always']] $gzip_static = undef,
Expand Down
16 changes: 16 additions & 0 deletions spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,22 @@
end
end

context 'when gzip is non-default (on) set gzip_proxied' do
let(:params) { { gzip: 'on' } }

context 'set gzip_proxied to a single value' do
let(:params) { super().merge({ gzip_proxied: 'any' }) }

it { is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(%r{ gzip_proxied any;}) }
end

context 'set gzip_proxied to multiple values' do
let(:params) { super().merge({ gzip_proxied: %w[no-cache expired] }) }

it { is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(%r{ gzip_proxied no-cache expired;}) }
end
end

context 'when gzip_static is non-default set gzip_static' do
let(:params) do
{
Expand Down
2 changes: 1 addition & 1 deletion templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ http {
gzip_min_length <%= @gzip_min_length %>;
gzip_http_version <%= @gzip_http_version %>;
<% if @gzip_proxied -%>
gzip_proxied <%= @gzip_proxied %>;
gzip_proxied <%= Array(@gzip_proxied).uniq.join(' ') %>;
<% end -%>
<% if @gzip_types -%>
gzip_types <%= @gzip_types.kind_of?(Array) ? @gzip_types.join(' ') : @gzip_types %>;
Expand Down
Loading