diff --git a/README.md b/README.md
index 0748649e..d2b47479 100644
--- a/README.md
+++ b/README.md
@@ -152,7 +152,7 @@ Installs and configures [Consul][1].
attribute to the IP of the specified interface if it exists.
nil |
-
+
['consul']['advertise_interface'] |
String |
@@ -162,6 +162,15 @@ Installs and configures [Consul][1].
nil |
+
+ ['consul']['extra_params'] |
+ Hash |
+
+ Any extra params to be put in the agent options
+ http://www.consul.io/docs/agent/options.html
+ |
+ {} |
+
### Consul UI Attributes
diff --git a/attributes/default.rb b/attributes/default.rb
index 3e38f3cf..c3619c11 100644
--- a/attributes/default.rb
+++ b/attributes/default.rb
@@ -70,3 +70,4 @@
default['consul']['client_addr'] = '0.0.0.0'
default['consul']['ui_dir'] = '/var/lib/consul/ui'
default['consul']['serve_ui'] = false
+default['consul']['extra_params'] = {}
diff --git a/recipes/_service.rb b/recipes/_service.rb
index cc7a00aa..8c411eab 100644
--- a/recipes/_service.rb
+++ b/recipes/_service.rb
@@ -63,7 +63,7 @@
end
# Determine service params
-service_config = {}
+service_config = JSON.parse(node['consul']['extra_params'].to_json)
service_config['data_dir'] = node['consul']['data_dir']
num_cluster = node['consul']['bootstrap_expect'].to_i
diff --git a/spec/unit/recipes/_service_spec.rb b/spec/unit/recipes/_service_spec.rb
index a9fcd992..dab5ac21 100644
--- a/spec/unit/recipes/_service_spec.rb
+++ b/spec/unit/recipes/_service_spec.rb
@@ -131,4 +131,18 @@
.with_content(/server3/)
end
end
+
+ context 'with extra params' do
+ let(:chef_run) do
+ ChefSpec::Runner.new(node_attributes) do |node|
+ node.set['consul']['extra_params']['disable_remote_exec'] = true
+ end.converge(described_recipe)
+ end
+ it do
+ expect(chef_run).to_not create_file('/etc/consul.d/default.json')
+ .with_content(/"disable_remote_exec" : "true"/)
+ end
+ end
+
+
end