I've got a multi-environment setup similar to the following, and thinking about adding database details to the index.php. In this way, I can pretty much just edit the index.php when creating new websites - staying out of app/config.
switch ($_SERVER['SERVER_NAME']) {
case 'local.craft.dev':
define('CRAFT_ENVIRONMENT', 'local');
define('CRAFT_DB_USER', 'root');
define('CRAFT_DB_PASSWORD', 'craftycraft');
define('CRAFT_DB_DATABASE', 'local');
break;
case 'staging.com':
define('CRAFT_ENVIRONMENT', 'staging');
break;
default:
define('CRAFT_ENVIRONMENT', 'production');
break;
}
Would there any potential security issues with this? I imagine being in the web root might be risky - but would having this information in db.php a level up really made a difference to a hacker?
Would like to hear your thoughts!