Permalink
Browse files

Add and use settings.php template.

When a change is made to the databse password attribute it is not reflected in settings.php.  The result is that the code base can no longer comminicate with its database and problems such as those described in promet/drupal-cookbook#5 arise.

This issue is partly the result of using drush-install to install drupal and not using a template to override the settins.php file.

Unfortunately drush-install does not currently allow a changes to settings.php file via the command line (as far as I'm aware).  Therefore, this issue reimplements the template process for configuring the settins.php file.  Since d7 and d6 have different settins.php formats, a template is provided for each (@todo add d8 template).

This reverts part of commit 4547328.

Conflicts:
	attributes/default.rb
	metadata.rb
	recipes/default.rb
  • Loading branch information...
1 parent b446aea commit 7c2a4e05d6c1414f70f9d74e51efd385f114700f @dkinzer dkinzer committed Feb 17, 2013
View
@@ -81,6 +81,17 @@
action :create
end
+template "#{node['drupal']['dir']}/sites/default/settings.php" do
+ source "d#{node['drupal']['version'][0..0]}.settings.php.erb"
+ mode "0644"
+ variables(
+ 'database' => node['drupal']['db']['database'],
+ 'user' => node['drupal']['db']['user'],
+ 'password' => node['drupal']['db']['password'],
+ 'host' => node['drupal']['db']['host'],
+ )
+end
+
if node['drupal']['modules']
node['drupal']['modules'].each do |m|
if m.is_a?Array
@@ -89,7 +89,7 @@
* $db_url = 'mysqli://username:password@localhost/databasename';
* $db_url = 'pgsql://username:password@localhost/databasename';
*/
-$db_url = 'mysql://<%= @user %>:<%= @password %>@<%= @database_host %>/<%= @database %>';
+$db_url = 'mysql://<%= @user %>:<%= @password %>@<%= @host %>/<%= @database %>';
$db_prefix = '';
/**
Oops, something went wrong.

0 comments on commit 7c2a4e0

Please sign in to comment.