Skip to content

Commit

Permalink
Merge pull request voxpupuli#891 from wyardley/issues_742
Browse files Browse the repository at this point in the history
try to improve spacing in generated configs (Issue voxpupuli#742)
  • Loading branch information
bastelfreak authored Sep 29, 2016
2 parents 7d84059 + 410c818 commit 3314acd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
3 changes: 1 addition & 2 deletions templates/conf.d/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ worker_rlimit_nofile <%= @worker_rlimit_nofile %>;
pid <%= @pid %>;
<% end -%>
error_log <%= @nginx_error_log %> <%= @nginx_error_log_severity %>;

<% if @nginx_cfg_prepend -%>

<%- field_width = @nginx_cfg_prepend.inject(0) { |l,(k,v)| k.size > l ? k.size : l } -%>
<%- @nginx_cfg_prepend.sort_by{|k,v| k}.each do |key,value| -%>
<%- Array(value).each do |asubvalue| -%>
Expand Down Expand Up @@ -60,7 +60,6 @@ http {
tcp_nopush on;
<%- end -%>
<% end -%>

server_tokens <%= @server_tokens %>;

types_hash_max_size <%= @types_hash_max_size %>;
Expand Down
1 change: 0 additions & 1 deletion templates/vhost/vhost_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ server {

access_log <%= @access_log_real %>;
error_log <%= @error_log_real %>;

<% if @error_pages -%>
<%- @error_pages.keys.sort.each do |key| -%>
error_page <%= key %> <%= @error_pages[key] %>;
Expand Down
2 changes: 1 addition & 1 deletion templates/vhost/vhost_ssl_footer.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if @include_files %>
<% if @include_files -%>
<%- @include_files.each do |file| -%>
include <%= file %>;
<%- end -%>
Expand Down
5 changes: 2 additions & 3 deletions templates/vhost/vhost_ssl_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,13 @@ server {

access_log <%= @ssl_access_log_real %>;
error_log <%= @ssl_error_log_real %>;

<% if @error_pages -%>
<%- @error_pages.keys.sort.each do |key| -%>
error_page <%= key %> <%= @error_pages[key] %>;
<%- end -%>
<% end -%>


<% if @vhost_cfg_prepend -%>

<%- @vhost_cfg_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<%- if value.is_a?(Hash) -%>
<%- value.sort_by {|k,v| k}.each do |subkey,subvalue| -%>
Expand All @@ -107,6 +105,7 @@ server {
<%- end -%>
<% end -%>
<% if @vhost_cfg_ssl_prepend -%>

<%- @vhost_cfg_ssl_prepend.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
<%- if value.is_a?(Hash) -%>
<%- value.sort_by {|k,v| k}.each do |subkey,subvalue| -%>
Expand Down

0 comments on commit 3314acd

Please sign in to comment.