CodeIgniter Forums
auto loading custom configuration files which override config.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: auto loading custom configuration files which override config.php (/thread-12258.html)



auto loading custom configuration files which override config.php - El Forum - 10-12-2008

[eluser]blasto333[/eluser]
Is is considered normal behavior that I should be allowed to override values in the config.php file with my custom configuration files? I am centralizing all the settings for my application in one file, so the user does not have to go all over the place to set it up.

Code:
<?php
$config['company']="Muench Inc!!";
$config['address']="";
$config['phone']="585-555-5555";
$config['email']="me@chrismuench.com";
$config['fax']="";
$config['website']="http://www.chrismuench.com";
$config['other']="";
$config['db_host']="localhost";
$config['db_name']="pos";
$config['db_user']="root";
$config['db_password']="******";
$config['default_tax_rate']="8";
$config['currency_symbol']="$";
$config['language'] = 'english';
?>



auto loading custom configuration files which override config.php - El Forum - 10-12-2008

[eluser]Pascal Kriete[/eluser]
Config.php is loaded very early on in the execution cycle - earlier than any custom autoloading takes place. Since it's just an array it'll be overriden if you redefine identical keys later. So yes, it's normal behavior. If you come back to this application after a year it may not feel like such a good idea though. Unless you stick to this pattern, of course Smile .

Creating your own database config definitely feels redundant.