Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.

Commit

Permalink
Fix the database password in database.yml by using search to retrieve…
Browse files Browse the repository at this point in the history
… the generated one from the db01.<environment> node
Sam Kottler committed Jun 29, 2014
1 parent 075ac97 commit acb4b18
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Berksfile.lock
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ GRAPH
rubygems-sensu (>= 0.0.0)
rubygems-ssh (>= 0.0.0)
rubygems-utility (>= 0.0.0)
rubygems-app (0.0.17)
rubygems-app (0.0.20)
apt (>= 0.0.0)
chef-vault (>= 0.0.0)
git (>= 0.0.0)
2 changes: 1 addition & 1 deletion cookbooks/rubygems-app/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name 'rubygems-app'

version '0.0.17'
version '0.0.20'

depends 'apt'
depends 'chef-vault'
6 changes: 3 additions & 3 deletions cookbooks/rubygems-app/recipes/config.rb
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
include_recipe 'chef-vault'

secrets = chef_vault_item('rubygems', node.chef_environment)
db_host = search(:node, "name:db01.#{node.chef_environment}.rubygems.org")[0]['ipaddress']
db_host = search(:node, "name:db01.#{node.chef_environment}.rubygems.org")

template '/applications/rubygems/shared/database.yml' do
source 'database.yml.erb'
@@ -18,8 +18,8 @@
adapter: 'postgresql',
database: "rubygems_#{node.chef_environment}",
username: secrets['rails_postgresql_user'],
password: secrets['rails_postgresql_password'],
host: db_host
password: db_host[0]['postgresql']['password']['postgres'],
host: db_host[0]['ipaddress']
)
end

0 comments on commit acb4b18

Please sign in to comment.