Joël Cox  committed 2a8a00b

Added documentation for environments

  • Participants
  • Parent commits dac049c
  • Branches default

Comments (0)

Files changed (2)

File user_guide/database/configuration.html

 <h1>Database Configuration</h1>
 <p>CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.).
-The config file is located at:</p>
+The config file is located at <samp>application/config/database.php</samp>. You can also set database connection values for specific <a href="../libraries/config.html">environments</a> by placing <strong>database.php</strong> it the respective environment config folder.</p>
 <p>The config settings are stored in a multi-dimensional array with this prototype:</p>

File user_guide/libraries/config.html

 <p>Where <var>item_name</var> is the $config array index you want to change, and <var>item_value</var> is its value.</p>
+<p>You can set the environment of you application and load config items depending on the current environment. It also disables PHP from displaying errors in environments other than development. To set your environment, open <strong>index.php</strong>, located at the root and change the <var>ENVIRONMENT</var> constant. By default, there is support for a development, test and production environment.</p>
+define('<var>ENVIRONMENT</var>', '<var>development</var>');	
+<p>To make a config file environment-aware, copy the file from <samp>application/config/</samp> to <samp>application/config/development/</samp>, depending on the environment the config file belongs to. You can place the following configuration files in environment folders:</p>
+<li>Default config files</li>
+<li>Database config files</li>
+<li>Custom config files</li>
+<p><strong>Note:</strong> CodeIgniter always tries to load the config file for the current environment first. If the file does not exist, the global config file (i.e. <samp>application/config/</samp>) is loaded. This means you are not obligated to place <strong>all</strong> your config files (but rather the files that change per environment) in an environment folder.</p>
 <h2>Helper Functions</h2>