Skip to content

Commit

Permalink
Revert "changed the php, rails and java cookbooks to use an attribute…
Browse files Browse the repository at this point in the history
… instead of"

This reverts commit fde7d73.
  • Loading branch information
githuesch committed May 14, 2014
1 parent f058381 commit dcce7c6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
6 changes: 0 additions & 6 deletions opsworks_java/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
# See also: http://docs.aws.amazon.com/opsworks/latest/userguide/customizing.html
###

include_attribute 'deploy'

node[:deploy].each do |application, deploy|
default[:deploy][application][:database][:port] = 3306
end

default['opsworks_java'] = {}

default['opsworks_java']['jvm'] = 'openjdk'
Expand Down
6 changes: 5 additions & 1 deletion opsworks_java/templates/default/webapp_context.xml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
maxActive="20" maxIdle="5" maxWait="10000"
username="<%= node['deploy'][@application]['database']['username'] %>" password="<%= node['deploy'][@application]['database']['password'] %>"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://<%= node['deploy'][@application]['database']['host'] %>:<%= node['deploy'][@application]['database']['port'] %>/<%= node['deploy'][@application]['database']['database'] %>"
<% if node['deploy'][@application]['database']['port'] %>
url="jdbc:mysql://<%= node['deploy'][@application]['database']['host'] %>:<%= if node['deploy'][@application]['database']['port'] %>/<%= node['deploy'][@application]['database']['database'] %>"
<% else %>
url="jdbc:mysql://<%= node['deploy'][@application]['database']['host'] %>:3306/<%= node['deploy'][@application]['database']['database'] %>"
<% end %>
factory="org.apache.commons.dbcp.BasicDataSourceFactory" />
</Context>
4 changes: 0 additions & 4 deletions php/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@

include_attribute 'deploy'

node[:deploy].each do |application, deploy|
default[:deploy][application][:database][:port] = 3306
end

include_attribute "php::customize"
4 changes: 3 additions & 1 deletion php/templates/default/opsworks.php.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ class OpsWorksDb {
$this->database = '<%= @database[:database] %>';
$this->encoding = 'utf8';
$this->host = '<%= @database[:host] %>';
$this->host = '<%= @database[:port] %>';
<% if @database[:port] %>
$this->host = '<%= @database[:port] %>';
<% end %>
$this->host = '<%= @database[:host] %>';
$this->username = '<%= @database[:username] %>';
$this->password = '<%= @database[:password] %>';
Expand Down
5 changes: 0 additions & 5 deletions rails/attributes/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,4 @@

default[:rails][:version] = "2.3.5"

node[:deploy].each do |application, deploy|
default[:deploy][application][:database][:port] = 3306
end


include_attribute "rails::customize"
4 changes: 3 additions & 1 deletion rails/templates/default/database.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
username: <%= @database[:username].to_s.inspect %>
password: <%= @database[:password].to_s.inspect %>
reconnect: <%= @database[:reconnect] ? 'true' : 'false' %>
port: <%= @database[:port].to_i.inspect %>
<% if @database[:pool] -%>
pool: <%= @database[:pool].to_i.inspect %>
<% end -%>
<% if @database[:port] -%>
port: <%= @database[:port].to_i.inspect %>
<% end -%>

<% end %>

0 comments on commit dcce7c6

Please sign in to comment.