Environment Based Database Selection In Drupal
boz — Mon, 03/15/2010 - 11:07
I needed to find a way to have only one settings.php file maintain my database configurations across both my local development and environment and my production server. Here is my solution. Is there a better way?
if($_SERVER['SERVER_NAME'] == "local.mydomain.com"){
$db_url = 'mysql://username:password@localhost/databasename';
}
else{
$db_url = 'mysql://username:password@production/databasename';
}
