-
-
Notifications
You must be signed in to change notification settings - Fork 881
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
Support map blocks #258
Comments
This is the extraordinarily ghetto way I hacked around it: diff --git a/manifests/config.pp b/manifests/config.pp
index 4aae9e2..c2c2054 100644
--- a/manifests/config.pp
+++ b/manifests/config.pp
@@ -35,6 +35,7 @@ class nginx::config(
$nginx_error_log = $nginx::params::nx_nginx_error_log,
$http_access_log = $nginx::params::nx_http_access_log,
$proxy_buffer_size = $nginx::params::nx_proxy_buffer_size,
+ $blocks = [],
$gzip = $nginx::params::nx_gzip,
) inherits nginx::params {
diff --git a/manifests/init.pp b/manifests/init.pp
index 4bc00eb..e7b4387 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -59,6 +59,7 @@ class nginx (
$nginx_upstreams = {},
$nginx_locations = {},
$manage_repo = $nginx::params::manage_repo,
+ $blocks = [],
) inherits nginx::params {
include stdlib
@@ -136,6 +137,7 @@ class nginx (
nginx_error_log => $nginx_error_log,
http_access_log => $http_access_log,
gzip => $gzip,
+ blocks => $blocks,
require => Class['nginx::package'],
notify => Class['nginx::service'],
}
diff --git a/templates/conf.d/nginx.conf.erb b/templates/conf.d/nginx.conf.erb
index 1b8502e..8c0fcf1 100644
--- a/templates/conf.d/nginx.conf.erb
+++ b/templates/conf.d/nginx.conf.erb
@@ -39,6 +39,8 @@ http {
proxy_cache_path <%= @proxy_cache_path %> levels=<%= @proxy_cache_levels %> keys
<% end -%>
+ <% Array(@blocks).each do |blockValue| %> <%= blockValue %><% end %>
+
<% if @http_cfg_append -%><% @http_cfg_append.sort_by{|k,v| k}.each do |key,value| -%
<%= key %> <%= value %>;
<% end -%> And then my nginx declaration looked like this: class { 'nginx':
blocks => [
'map $http_accept $error_doc {
default /error.html;
~application/json /error.json;
}']
} |
Does #337 add what you need? If so you can close this issue. |
@3flex Yeah, that looks like it should work. Closing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There doesn't seem to be a way to accomplish outputting something like this in
nginx.conf
:Using
http_cfg_append
puts an extra semicolon after the closing}
.The text was updated successfully, but these errors were encountered: