From 42aa95bfee77baa6d4fe2728c4a02c61b7a3cac1 Mon Sep 17 00:00:00 2001 From: joelcox Date: Sun, 16 Jan 2011 18:16:21 +0100 Subject: Added documentation for environments --- user_guide/database/configuration.html | 4 +--- user_guide/libraries/config.html | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'user_guide') diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html index 893db6221..34d267596 100644 --- a/user_guide/database/configuration.html +++ b/user_guide/database/configuration.html @@ -61,9 +61,7 @@ Configuration

Database Configuration

CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.). -The config file is located at:

- -

application/config/database.php

+The config file is located at application/config/database.php. You can also set database connection values for specific environments by placing database.php it the respective environment config folder.

The config settings are stored in a multi-dimensional array with this prototype:

diff --git a/user_guide/libraries/config.html b/user_guide/libraries/config.html index bfb679457..10892de38 100644 --- a/user_guide/libraries/config.html +++ b/user_guide/libraries/config.html @@ -150,6 +150,23 @@ $site_name = $blog_config['site_name'];

Where item_name is the $config array index you want to change, and item_value is its value.

+

Environments

+ +

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 index.php, located at the root and change the ENVIRONMENT constant. By default, there is support for a development, test and production environment.

+ + +define('ENVIRONMENT', 'development'); + + +

To make a config file environment-aware, copy the file from application/config/ to application/config/development/, depending on the environment the config file belongs to. You can place the following configuration files in environment folders:

+ + + +

Note: 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. application/config/) is loaded. This means you are not obligated to place all your config files (but rather the files that change per environment) in an environment folder.

Helper Functions

-- cgit v1.2.3-24-g4f1b