Skip to content
Permalink
Browse files

fix: Support for multiple RDSes with multiple applications

  • Loading branch information...
ajgon committed Jun 16, 2016
1 parent 4aeac7f commit a23df47c8c1a9654239ac87cae03f0d44d610cd4
Showing with 17 additions and 1 deletion.
  1. +8 −1 README.md
  2. +9 −0 libraries/drivers_db_base.rb
@@ -3,6 +3,7 @@
[![Chef cookbook](https://img.shields.io/cookbook/v/opsworks_ruby.svg)](https://supermarket.chef.io/cookbooks/opsworks_ruby)
[![Build Status](https://travis-ci.org/ajgon/opsworks_ruby.svg?branch=master)](https://travis-ci.org/ajgon/opsworks_ruby)
[![Coverage Status](https://coveralls.io/repos/github/ajgon/opsworks_ruby/badge.svg?branch=master)](https://coveralls.io/github/ajgon/opsworks_ruby?branch=master)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![license](https://img.shields.io/github/license/ajgon/opsworks_ruby.svg?maxAge=2592000)](https://opsworks-ruby.mit-license.org/)

A [chef](https://www.chef.io/) cookbook to deploy Ruby applications to Amazon OpsWorks.
@@ -272,8 +273,14 @@ to corresponding OpsWorks actions.
Please see [CONTRIBUTING](https://github.com/ajgon/opsworks_ruby/blob/master/CONTRIBUTING.md)
for details.

## Author and License
## Author and Contributors

Author: Igor Rzegocki <[igor@rzegocki.pl](mailto:igor@rzegocki.pl)>

### Contributors

* Nathan Flood ([@npflood](https://github.com/npflood))

## License

License: [MIT](http://opsworks-ruby.mit-license.org/)
@@ -18,6 +18,8 @@ def setup(context)
end

def configure(context)
return unless applicable_for_configuration?

database = out
rails_env = app['attributes']['rails_env']
context.template File.join(deploy_dir(app), 'shared', 'config', 'database.yml') do
@@ -58,6 +60,13 @@ def app_engine
def node_engine
node['deploy'][app['shortname']]['database'].try(:[], 'adapter')
end

private

def applicable_for_configuration?
configuration_data_source == :node_engine || app['data_sources'].first.blank? || options[:rds].blank? ||
app['data_sources'].first['arn'] == options[:rds]['rds_db_instance_arn']
end
end
end
end

0 comments on commit a23df47

Please sign in to comment.
You can’t perform that action at this time.