Add the prosody module
[mirror/dsa-puppet.git] / 3rdparty / modules / prosody / templates / virtualhost.cfg.erb
1 VirtualHost "<%= @name %>"
2 <% if @ensure == 'present' -%>
3   enabled = true
4 <% else -%>
5   enabled = false
6 <% end -%>
7
8 <% if (@ssl_key != 'UNSET') && (@ssl_cert != 'UNSET') -%>
9   -- Assign this host a certificate for TLS, otherwise it would use the one
10   -- set in the global section (if any).
11   -- Note that old-style SSL on port 5223 only supports one certificate, and will always
12   -- use the global one.
13   ssl = {
14     key = "<%= @prosody_ssl_key %>";
15     certificate = "<%= @prosody_ssl_cert %>";
16   }
17 <% end -%>
18
19 <%- if @custom_options != {} -%>
20 <%-
21 def print_recursive(object, indentation = 0)
22   case object
23   when Array
24     '{ "' + object.join('"; "') + '" }'
25   when Hash
26     "{\n" + ' ' * (indentation + 2) + object.map {|k,v| + "#{k} = " + print_recursive(v, indentation + 2)}.join(";\n" + ' ' * (indentation + 2)) + ";\n" + (' ' * indentation) + '}'
27   when TrueClass, FalseClass
28     object.to_s
29   else
30     '"' + object.to_s + '"'
31   end
32 end
33 -%>
34 ------ Custom config options ------
35 <%- @custom_options.sort.each do |option, value| -%>
36 <%= option %> = <%= print_recursive(value) %>
37 <%- end; end -%>
38
39 <%- if @components != {} -%>
40 ------ Components ------
41 -- You can specify components to add hosts that provide special services,
42 -- like multi-user conferences, and transports.
43 -- For more information on components, see http://prosody.im/doc/components
44
45 <% @components.sort.each do |name, component| %>
46 Component "<%= name %>" <% if component.include?('type') then %>"<%= component['type'] %>"<% end %>
47   <%- if component.include?('secret') -%>
48   component_secret = "<%= component['secret'] %>"
49   <%- end -%>
50   <%- if component.include?('options') -%>
51     <%- component['options'].sort.each do |k, v| -%>
52   <%= k %> = <%= v %>;
53     <%- end -%>
54   <%- end -%>
55 <% end -%>
56 <% end -%>