Skip to content

Commit

Permalink
Merge pull request #15 from bkw/moParams
Browse files Browse the repository at this point in the history
support more configuration parameters
  • Loading branch information
John Bellone committed Jun 9, 2014
2 parents 84b63f9 + b49941d commit dc205fb
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ suites:
- name: default
run_list:
- recipe[consul::default]
attributes:
consul:
datacenter: FortMeade
- name: ui
run_list:
- recipe[consul::default]
Expand Down
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,45 @@ Ubuntu 12.04, 14.04
<td>Consul servers to join</td>
<td><tt>[]</tt></td>
</tr>
<tr>
<td><tt>['consul']['bind_addr']</tt></td>
<td>String</td>
<td>address that should be bound to for internal cluster communications</td>
<td><tt>0.0.0.0</tt></td>
</tr>
<tr>
<td><tt>['consul']['datacenter']</tt></td>
<td>String</td>
<td>Name of Datacenter</td>
<td><tt>dc1</tt></td>
</tr>
<tr>
<td><tt>['consul']['domain']</tt></td>
<td>String</td>
<td>Domain for service lookup dns queries</td>
<td><tt>.consul</tt></td>
</tr>
<tr>
<td><tt>['consul']['log_level']</tt></td>
<td>String</td>
<td>
The level of logging to show after the Consul agent has started.
Available: "trace", "debug", "info", "warn", "err"
</td>
<td><tt>info</tt></td>
</tr>
<tr>
<td><tt>['consul']['node_name']</tt></td>
<td>String</td>
<td>The name of this node in the cluster</td>
<td>hostname of the machine</td>
</tr>
<tr>
<td><tt>['consul']['advertise_addr']</tt></td>
<td>String</td>
<td>address that we advertise to other nodes in the cluster</td>
<td>Value of <i>bind_addr</i></td>
</tr>
</table>

### Consul UI Attributes
Expand Down
9 changes: 9 additions & 0 deletions recipes/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@
service_config[:client_addr] = node[:consul][:client_addr]
end

copy_params = [
:bind_addr, :datacenter, :domain, :log_level, :node_name, :advertise_addr
]
copy_params.each do |key|
if node[:consul][key]
service_config[key] = node[:consul][key]
end
end

directory node[:consul][:config_dir]

template '/etc/init.d/consul' do
Expand Down
13 changes: 13 additions & 0 deletions test/integration/default/serverspec/localhost/consul_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,16 @@
it { should be_listening }
end
end

describe command "consul members" do
it { should return_exit_status 0 }
it { should return_stdout /\balive\b/ }
it { should return_stdout /\brole=consul\b/ }
it { should return_stdout /\bbootstrap=1\b/ }
end

describe "config file attributes" do
context command "consul members" do
it { should return_stdout /\bdc=FortMeade\b/ }
end
end

0 comments on commit dc205fb

Please sign in to comment.