I am using CodeIgniter to write a application. I need to create something like this: - I will have: -
- my_config.php
- config_production.php
- config_development.php
Now, my_config.php will be autoloaded. From there, if it is production server config_production.php will be loaded. Else config_development.php will be loaded.
how should I do this?
I tried doing like this in my_config.php: -
<?php
if(gethostbyaddr ("127.0.0.1") == 'hello.sabya'){
$this->config->load('config_production');
} else {
$this->config->load('config_development');
}
?>
It is not working because, the "$this->config" is not initialized yet.
How can I achieve this?