Skip to content

Commit

Permalink
Merge pull request #98 from inean/master
Browse files Browse the repository at this point in the history
Allow custom data bag and data bag item for consul encrypt
  • Loading branch information
johnbellone committed Dec 13, 2014
2 parents 72b9230 + 2ebad90 commit 8dc6de1
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 8dc6de1

Please sign in to comment.