module-nginx/templates/conf.d/map.erb

17 lines
401 B
Text
Raw Permalink Normal View History

# MANAGED BY PUPPET
2014-06-12 20:12:24 +02:00
map <%= @string %> $<%= @name %> {
<% if @hostnames -%>
hostnames;
<% end -%>
<% if @default -%>
default <%= @default %>;
<% end -%>
2014-06-12 20:12:24 +02:00
<% if @mappings -%>
<%- field_width = @mappings.inject(0) { |l,(k,v)| k.size > l ? k.size : l } -%>
2014-06-12 20:12:24 +02:00
<%- @mappings.sort_by{|k,v| k}.each do |key,value| -%>
<%= sprintf("%-*s", field_width, key) %> <%= value %>;
2014-06-12 20:12:24 +02:00
<%- end -%>
<% end -%>
}