Skip to content

Commit

Permalink
Merge pull request #308 from daniel-gadd/feature/config_syntax
Browse files Browse the repository at this point in the history
Fixed up rabbitmq.conf file layout
  • Loading branch information
cmurphy committed Feb 23, 2015
2 parents 2f955e1 + 74accfc commit 1ad0a6e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
15 changes: 10 additions & 5 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,10 @@
%r{ssl_listeners, \[3141\]}
)
should contain_file('rabbitmq.config').with_content(
%r{ssl_options, \[\{cacertfile,"/path/to/cacert"}
%r{ssl_options, \[}
)
should contain_file('rabbitmq.config').with_content(
%r{cacertfile,"/path/to/cacert"}
)
should contain_file('rabbitmq.config').with_content(
%r{certfile,"/path/to/cert"}
Expand All @@ -507,7 +510,7 @@

it 'should set ssl options to specified values' do
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
end
Expand All @@ -528,7 +531,8 @@
it 'should set ssl options to specified values' do
should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]})
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]})
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[})
should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
end
Expand All @@ -548,7 +552,7 @@
it 'should set ssl options to specified values' do
should contain_file('rabbitmq.config').with_content(%r{tcp_listeners, \[\]})
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[\{"0.0.0.0", 3141\}\]})
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
end
Expand All @@ -566,7 +570,8 @@

it 'should set ssl options to specified values' do
should contain_file('rabbitmq.config').with_content(%r{ssl_listeners, \[3141\]})
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[\{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{ssl_options, \[})
should contain_file('rabbitmq.config').with_content(%r{cacertfile,"/path/to/cacert"})
should contain_file('rabbitmq.config').with_content(%r{certfile,"/path/to/cert"})
should contain_file('rabbitmq.config').with_content(%r{keyfile,"/path/to/key})
should contain_file('rabbitmq.config').with_content(%r{ssl, \[\{versions, \['tlsv1.1', 'tlsv1.2'\]\}\]})
Expand Down
20 changes: 12 additions & 8 deletions templates/rabbitmq.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@
<%- else -%>
{ssl_listeners, [<%= @ssl_port %>]},
<%- end -%>
{ssl_options, [<%- if @ssl_cacert != 'UNSET' -%>{cacertfile,"<%= @ssl_cacert %>"},<%- end -%>
{certfile,"<%= @ssl_cert %>"},
{keyfile,"<%= @ssl_key %>"},
{verify,<%= @ssl_verify %>},
{fail_if_no_peer_cert,<%= @ssl_fail_if_no_peer_cert %>}
<%- if @ssl_versions -%>
,{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}
<% end -%>]},
{ssl_options, [
<%- if @ssl_cacert != 'UNSET' -%>
{cacertfile,"<%= @ssl_cacert %>"},
<%- end -%>
{certfile,"<%= @ssl_cert %>"},
{keyfile,"<%= @ssl_key %>"},
{verify,<%= @ssl_verify %>},
{fail_if_no_peer_cert,<%= @ssl_fail_if_no_peer_cert %>}
<%- if @ssl_versions -%>
,{versions, [<%= @ssl_versions.sort.map { |v| "'#{v}'" }.join(', ') %>]}
<%- end -%>
]},
<%- end -%>
<% if @config_variables -%>
<%- @config_variables.keys.sort.each do |key| -%>
Expand Down

0 comments on commit 1ad0a6e

Please sign in to comment.