Split basic configuration in three environments, providing fallback to global
diff --git a/system/core/Common.php b/system/core/Common.php
index 6a3d5ac..48de161 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -209,13 +209,13 @@
 		}
 
 		// Fetch the config file
-		if ( ! file_exists(APPPATH.'config/config'.EXT))
+		if ( ! file_exists(APPPATH.'config/'.ENVIRONMENT.'/config'.EXT))
 		{
 			exit('The configuration file does not exist.');
 		}
 		else
 		{
-			require(APPPATH.'config/config'.EXT);
+			require(APPPATH.'config/'.ENVIRONMENT.'/config'.EXT);
 		}
 
 		// Does the $config array exist in the file?
diff --git a/system/core/Config.php b/system/core/Config.php
index 8ecfba7..56e3bcc 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -30,6 +30,7 @@
 
 	var $config = array();
 	var $is_loaded = array();
+	var $environment = ENVIRONMENT;
 	var $_config_paths = array(APPPATH);
 
 	/**
@@ -74,6 +75,8 @@
 	 *
 	 * @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 @@
 		$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 @@
 				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 @@
 			{
 				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;
 	}