codeigniter access config.php in database.php
At my work we have a typical setup
Develop on localhost
Test on staging Live on productionWe are using codeigniter.
Obviously it is a real pain having to change all 开发者_开发问答the settings every time we move them around.
What I want to do is.
in config.php have $config['env'] = 'localhost'; //'test'; //'production';
Then in my database.php
and email.php
$env = //config env variable
if($env === 'localhost'){
//localhost settings
} elseif($env === 'test'){
//staging settings
} elseif($env === 'production'){
//production settings
}
How can I do this?
In 1.7.x you can do this:
In database.php:
$CI = get_instance();
$active_group = $CI->config->item("active_group");
So that in config.php you can have:
$config['active_group'] = 'development'; // production, staging, etc
精彩评论