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 setting a custom path for mime.types #1321

Merged
merged 1 commit into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
$keepalive_requests = $nginx::keepalive_requests
$log_format = $nginx::log_format
$mail = $nginx::mail
$mime_types_path = $nginx::mime_types_path
$stream = $nginx::stream
$mime_types = $nginx::mime_types_preserve_defaults ? {
true => merge($nginx::params::mime_types,$nginx::mime_types),
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
$keepalive_requests = '100',
$log_format = {},
Boolean $mail = false,
Variant[String, Boolean] $mime_types_path = 'mime.types',
jacksgt marked this conversation as resolved.
Show resolved Hide resolved
Boolean $stream = false,
String $multi_accept = 'off',
Integer $names_hash_bucket_size = 64,
Expand Down
8 changes: 7 additions & 1 deletion spec/classes/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -974,11 +974,17 @@
context 'when conf_dir is /path/to/nginx' do
let(:params) { { conf_dir: '/path/to/nginx' } }

it { is_expected.to contain_file('/path/to/nginx/nginx.conf').with_content(%r{include /path/to/nginx/mime\.types;}) }
it { is_expected.to contain_file('/path/to/nginx/nginx.conf').with_content(%r{include mime\.types;}) }
it { is_expected.to contain_file('/path/to/nginx/nginx.conf').with_content(%r{include /path/to/nginx/conf\.d/\*\.conf;}) }
it { is_expected.to contain_file('/path/to/nginx/nginx.conf').with_content(%r{include /path/to/nginx/sites-enabled/\*;}) }
end

context 'when mime_types_path is /path/to/mime.types' do
let(:params) { { mime_types_path: '/path/to/mime.types' } }

it { is_expected.to contain_file('/etc/nginx/nginx.conf').with_content(%r{include /path/to/mime\.types;}) }
end

context 'when confd_purge true' do
let(:params) { { confd_purge: true } }

Expand Down
4 changes: 3 additions & 1 deletion templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ http {
<%- end -%>
<%- end -%>
<% end -%>
include <%= @conf_dir %>/mime.types;
<% if @mime_types_path.is_a? String and @mime_types_path.empty? == false -%>
include <%= @mime_types_path %>;
<% end -%>
default_type application/octet-stream;
<% if @log_format -%>
<% @log_format.sort_by{|k,v| k}.each do |key,value| -%>
Expand Down