summaryrefslogtreecommitdiffstats
path: root/system/core/Config.php
diff options
context:
space:
mode:
authorjoelcox <joel@mickly.com>2011-01-15 23:09:47 +0100
committerjoelcox <joel@mickly.com>2011-01-15 23:09:47 +0100
commitcee8075e2f8fdeb0d8516b5af8ae7cd7754ac513 (patch)
tree7cba1d3ea12370bb7b8031585c6604cc7087cc1f /system/core/Config.php
parent87a5cf3ee39cb76ff2ba50d49ca5d03588a3fd9f (diff)
Split basic configuration in three environments, providing fallback to global
Diffstat (limited to 'system/core/Config.php')
-rw-r--r--system/core/Config.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/system/core/Config.php b/system/core/Config.php
index 8ecfba73a..56e3bccd8 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -30,6 +30,7 @@ class CI_Config {
var $config = array();
var $is_loaded = array();
+ var $environment = ENVIRONMENT;
var $_config_paths = array(APPPATH);
/**
@@ -74,6 +75,8 @@ class CI_Config {
*
* @access public
* @param string the config file name
+ * @param boolean if configuration values should be loaded into their own section
+ * @param boolean true if errors should just return false, false if an error message should be displayed
* @return boolean if the file was loaded correctly
*/
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
@@ -82,8 +85,8 @@ class CI_Config {
$loaded = FALSE;
foreach($this->_config_paths as $path)
- {
- $file_path = $path.'config/'.$file.EXT;
+ {
+ $file_path = $path.'config/'.ENVIRONMENT.'/'.$file.EXT;
if (in_array($file_path, $this->is_loaded, TRUE))
{
@@ -91,9 +94,12 @@ class CI_Config {
continue;
}
- if ( ! file_exists($path.'config/'.$file.EXT))
+ if ( ! $file_path)
{
- continue;
+ if ( ! file_exists($path.'config/'.$file.EXT))
+ {
+ $file_path = $path.'config/'.$file.EXT;
+ }
}
include($file_path);
@@ -136,9 +142,9 @@ class CI_Config {
{
return FALSE;
}
- show_error('The configuration file '.$file.EXT.' does not exist.');
+ show_error('The configuration file '.$environment.'/'.$file.EXT.' does not exist.');
}
-
+
return TRUE;
}