[eluser]Elliot Haughin[/eluser]
In terms of the 'singe' config file... that's a simple probem to solve.
In all of your 'individual' config files, just put something like:
Code:
include('/home/user/etc/etc/config.php');
Using a full path, to hit the same config file. Then, in your single config file (at /home/user/etc/etc/config.php) put in the 'normal' contents of a config file.
And the same goes for your db.php, routes.php, pretty much any file that just sets up some local vars like: $config['something'] or $db['something']
Then, to have different database connection based on your environment, try this little gem:
Code:
$development_domain = 'elliot.dev';
$production_domain = 'bigsite.com';
$active_record = TRUE;
$db['development']['hostname'] = "localhost";
$db['development']['username'] = "root";
$db['development']['password'] = "";
$db['development']['database'] = "dev_db";
$db['development']['dbdriver'] = "mysql";
$db['development']['dbprefix'] = "";
$db['development']['pconnect'] = TRUE;
$db['development']['db_debug'] = FALSE;
$db['development']['cache_on'] = FALSE;
$db['development']['cachedir'] = "";
$db['development']['char_set'] = "utf8";
$db['development']['dbcollat'] = "utf8_general_ci";
$db['production']['hostname'] = "mysql.mydomain.com";
$db['production']['username'] = "locked_down_production_user";
$db['production']['password'] = "verylovelypassword";
$db['production']['database'] = "production_db";
$db['production']['dbdriver'] = "mysql";
$db['production']['dbprefix'] = "";
$db['production']['pconnect'] = TRUE;
$db['production']['db_debug'] = FALSE;
$db['production']['cache_on'] = FALSE;
$db['production']['cachedir'] = "";
$db['production']['char_set'] = "utf8";
$db['production']['dbcollat'] = "utf8_general_ci";
if ($domain = $_SERVER['HTTP_HOST'])
{
$domain = $_SERVER['SERVER_NAME'];
}
if ( empty($domain) )
{
$domain = $production_domain;
}
switch ($domain)
{
case $production_domain;
$active_group = 'production';
break;
case $development_domain:
$active_group = 'development';
break;
default:
$active_group = 'production';
break;
}
For your new 'common' database.php file