Config Class
Note: This page is an extension of the CodeIgniter User Guide page of the same name. Please read the CodeIgniter Config Class page in addition to this page for complete information about this feature.
Augmenting Primary and Custom Config Files
The primary config file and custom config files can be augmented by putting versions of the config files at the system and document levels. The config files are not overridden the way view, JavaScript, and CSS files are; CoolBrew gathers the contents of these files in up to three different locations and then merges them to make a combined config file.
CoolBrew looks for config files in each of these locations:
- DOCPATH/config/
- system/MODULE_NAME/config/
- system/config/
The locations are shown in priority order. In other words, the contents of the first location will take priority over the others, and the contents of the second location will take priority over the third. Let's look at an example:
Lets say that we want to increase the logging threshold on one of our websites so we can debug some issues we're encountering. The system/config/config.php file (our second location) is set to log only errors:
$config['log_threshold'] = 1;
$config['log_path'] = '';
$config['log_date_format'] = 'Y-m-d H:i:s';
We can create a new config.php file and place it in DOCPATH/config/ with this information:
$config['log_threshold'] = 4;
The resulting merged config file will look like this for files in that specific website:
$config['log_threshold'] = 4;
$config['log_path'] = '';
$config['log_date_format'] = 'Y-m-d H:i:s';
Note: You do not need to include all the config items in your document-level config file; you can simply list the items you need changed and they will override the main list on an item by item basis.