Skip to content

Commit

Permalink
Allow custom data bag and data bag item for consul encrypt
Browse files Browse the repository at this point in the history
  • Loading branch information
inean committed Dec 11, 2014
1 parent 72b9230 commit 2ebad90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
default['consul']['servers'] = []
default['consul']['init_style'] = 'init' # 'init', 'runit'

case node['consul']['init_style']
case node['consul']['init_style']
when 'runit'
default['consul']['service_user'] = 'consul'
default['consul']['service_group'] = 'consul'
Expand All @@ -79,6 +79,10 @@
"server" => 8300,
}

# Consul DataBag
default['consul']['data_bag'] = 'consul'
default['consul']['data_bag_encrypt_item'] = 'encrypt'

# Gossip encryption
default['consul']['encrypt_enabled'] = false
default['consul']['encrypt'] = nil
Expand Down
2 changes: 1 addition & 1 deletion libraries/encrypt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Recipe
def consul_encrypted_dbi
begin
# loads the secret from /etc/chef/encrypted_data_bag_secret
Chef::EncryptedDataBagItem.load('consul', 'encrypt')
Chef::EncryptedDataBagItem.load(node['consul']['data_bag'], node['consul']['data_bag_encrypt_item'])
rescue Net::HTTPServerException => e
raise e unless e.response.code == '404'
end
Expand Down

0 comments on commit 2ebad90

Please sign in to comment.