Skip to content

Commit df42434

Browse files
author
Joshua Hoblitt
committed
sort $vhost_cfg_append hash in vhost_footer.erb template
This is so the paremter ordering in the configuration is stable. It also force the :allow key (if it exists) to be first in the sort ordering. It would probably be better to change `$vhost_cfg_append` into an array of one key hashes but would require a public API change.
1 parent b13957c commit df42434

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

templates/vhost/vhost_footer.erb

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<% if @include_files %><% @include_files.each do |file| -%>
22
include <%= file %>;
33
<% end -%><% end -%>
4-
<% if @vhost_cfg_append -%><% vhost_cfg_append.each do |key,value| -%>
4+
<%# make sure that allow comes before deny by forcing the allow key (if it -%>
5+
<%# exists) to be first in the output order. The hash keys also need to be -%>
6+
<%# sorted so that the ordering is stable. -%>
7+
<% if @vhost_cfg_append -%><% vhost_cfg_append.sort_by{ |k, v| k.to_s == 'allow' ? '' : k.to_s }.each do |key,value| -%>
58
<%= key %> <%= value %>;
69
<% end -%>
710
<% end -%>

0 commit comments

Comments
 (0)