Skip to content

Commit

Permalink
Merge pull request #46 from abecciu/COOK-2803
Browse files Browse the repository at this point in the history
Add attribute to bind erlang networking to localhost.
  • Loading branch information
Joshua Timberman committed Jul 6, 2013
2 parents 8b41a99 + 915e107 commit d3c8069
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
default['rabbitmq']['default_user'] = 'guest'
default['rabbitmq']['default_pass'] = 'guest'

# bind erlang networking to localhost
default['rabbitmq']['local_erl_networking'] = false

#clustering
default['rabbitmq']['cluster'] = false
default['rabbitmq']['cluster_disk_nodes'] = []
Expand Down
5 changes: 5 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,8 @@
:description => "List all plugins that will be deactivated",
:default => [],
:type => "array"

attribute "rabbitmq/local_erl_networking",
:display_name => "Local Erlang networking",
:description => "Bind erlang networking to localhost"

5 changes: 5 additions & 0 deletions templates/default/rabbitmq-env.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
# Generated by Chef
###

<% if node['rabbitmq']['local_erl_networking'] -%>
NODENAME=rabbit@localhost
export ERL_EPMD_ADDRESS=127.0.0.1
<% else %>
<% if node['rabbitmq']['nodename'] -%>NODENAME=<%= node['rabbitmq']['nodename'] %><% end %>
<% end %>
<% if node['rabbitmq']['address'] -%>NODE_IP_ADDRESS=<%= node['rabbitmq']['address'] %><% end %>
<% if node['rabbitmq']['port'] -%>NODE_PORT=<%= node['rabbitmq']['port'] %><% end %>
<% if node['rabbitmq']['config'] -%>CONFIG_FILE=<%= node['rabbitmq']['config'] %><% end %>
Expand Down
3 changes: 3 additions & 0 deletions templates/default/rabbitmq.config.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
%%%

[
<% if node['rabbitmq']['local_erl_networking'] %>
{kernel, [{inet_dist_use_interface,{127,0,0,1}}]},
<% end %>
{rabbit, [
<% if node['rabbitmq']['cluster'] && node['rabbitmq']['cluster_disk_nodes'] -%>
{cluster_nodes, [<%= node['rabbitmq']['cluster_disk_nodes'].map{|n| "\'#{n}\'"}.join(',') %>]},
Expand Down

0 comments on commit d3c8069

Please sign in to comment.