Skip to content

Commit 4d4c551

Browse files
authored
Merge pull request #2344 from ekohl/simplify-templates
Simplify templates by reusing methods
2 parents bc6b90a + 0b70544 commit 4d4c551

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

templates/mod/ext_filter.conf.erb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# mod_ext_filter definitions
2-
<%- if @ext_filter_define.length >= 1 -%>
3-
<%- @ext_filter_define.keys.sort.each do |name| -%>
4-
ExtFilterDefine <%= name %> <%= @ext_filter_define[name] %>
5-
<%- end -%>
2+
<%- @ext_filter_define.sort.each do |name, value| -%>
3+
ExtFilterDefine <%= name %> <%= value %>
64
<%- end -%>

templates/vhost/_directories.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@
464464
<%- directory_proxy_pass.flatten.compact.each do |proxy| -%>
465465
<%= proxy_pass -%> <%= proxy['url'] -%>
466466
<%- if proxy['params'] -%>
467-
<%- proxy['params'].keys.sort.each do |key| -%> <%= key %>=<%= proxy['params'][key] -%>
467+
<%- proxy['params'].sort.each do |key, value| -%> <%= key %>=<%= value -%>
468468
<%- end -%>
469469
<%- end -%>
470470
<%- if proxy['keywords'] %> <%= proxy['keywords'].join(' ') -%>

templates/vhost/_proxy.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<%- end -%>
2020
ProxyPass <%= proxy['path'] %> <%= proxy['url'] -%>
2121
<%- if proxy['params'] -%>
22-
<%- proxy['params'].keys.sort.each do |key| -%> <%= key %>=<%= proxy['params'][key] -%>
22+
<%- proxy['params'].sort.each do |key, value| -%> <%= key %>=<%= value -%>
2323
<%- end -%>
2424
<%- end -%>
2525
<%- if proxy['keywords'] %> <%= proxy['keywords'].join(' ') -%>
@@ -56,7 +56,7 @@
5656
<%- end -%>
5757
ProxyPassMatch <%= proxy['path'] %> <%= proxy['url'] -%>
5858
<%- if proxy['params'] -%>
59-
<%- proxy['params'].keys.sort.each do |key| -%> <%= key %>=<%= proxy['params'][key] -%>
59+
<%- proxy['params'].sort.each do |key, value| -%> <%= key %>=<%= value -%>
6060
<%- end -%>
6161
<%- end -%>
6262
<%- if proxy['keywords'] %> <%= proxy['keywords'].join(' ') -%>

templates/vhost/_wsgi.erb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@
2525
WSGIProcessGroup <%= @wsgi_process_group %>
2626
<% end -%>
2727
<% if @wsgi_script_aliases_match and ! @wsgi_script_aliases_match.empty? -%>
28-
<%- @wsgi_script_aliases_match.keys.sort.reverse.each do |key| -%>
29-
<%- if key != '' and @wsgi_script_aliases_match[key] != ''-%>
30-
WSGIScriptAliasMatch <%= key %> "<%= @wsgi_script_aliases_match[key] %>"
28+
<%- @wsgi_script_aliases_match.sort.reverse.each do |key, value| -%>
29+
<%- if key != '' and value != ''-%>
30+
WSGIScriptAliasMatch <%= key %> "<%= value %>"
3131
<%- end -%>
3232
<%- end -%>
3333
<% end -%>
3434
<% if @wsgi_script_aliases and ! @wsgi_script_aliases.empty? -%>
35-
<%- @wsgi_script_aliases.keys.sort.reverse.each do |key| -%>
36-
<%- if key != '' and @wsgi_script_aliases[key] != ''-%>
37-
<%- if @wsgi_script_aliases[key].is_a? Array -%>
38-
WSGIScriptAlias <%= key %> <%= @wsgi_script_aliases[key].join(' ') %>
35+
<%- @wsgi_script_aliases.sort.reverse.each do |key, value| -%>
36+
<%- if key != '' and value != ''-%>
37+
<%- if value.is_a? Array -%>
38+
WSGIScriptAlias <%= key %> <%= value.join(' ') %>
3939
<%- else -%>
40-
WSGIScriptAlias <%= key %> "<%= @wsgi_script_aliases[key] %>"
40+
WSGIScriptAlias <%= key %> "<%= value %>"
4141
<%- end -%>
4242
<%- end -%>
4343
<%- end -%>

0 commit comments

Comments
 (0)