@@ -6,6 +6,10 @@ Database Configuration
66 :local:
77 :depth: 2
88
9+ ***********
10+ Config File
11+ ***********
12+
913CodeIgniter has a config file that lets you store your database
1014connection values (username, password, database name, etc.). The config
1115file is located at **app/Config/Database.php **. You can also set
@@ -22,6 +26,9 @@ while connecting to specify a group name.
2226.. note :: The default location of the SQLite3 database is in the ``writable`` folder.
2327 If you want to change the location, you must set the full path to the new folder.
2428
29+ DSN
30+ ===
31+
2532Some database drivers (such as PDO, PostgreSQL, Oracle, ODBC) might
2633require a full DSN string to be provided. If that is the case, you
2734should use the 'DSN' configuration setting, as if you're using the
@@ -45,6 +52,9 @@ add the config variables as a query string:
4552 database character set), which are present in the rest of the configuration
4653 fields, CodeIgniter will append them.
4754
55+ Failovers
56+ =========
57+
4858You can also specify failovers for the situation when the main connection cannot connect for some reason.
4959These failovers can be specified by setting the failover for a connection like this:
5060
@@ -69,14 +79,18 @@ variable located in the config file:
6979 default we've used the word "default" for the primary connection,
7080 but it too can be renamed to something more relevant to your project.
7181
82+ defaultGroup
83+ ============
84+
7285You could modify the config file to detect the environment and automatically
7386update the `defaultGroup ` value to the correct one by adding the required logic
7487within the class' constructor:
7588
7689.. literalinclude :: configuration/008.php
7790
78- Configuring With .env File
79- --------------------------
91+ **************************
92+ Configuring with .env File
93+ **************************
8094
8195You can also save your configuration values within a **.env ** file with the current server's
8296database settings. You only need to enter the values that change from what is in the
@@ -89,8 +103,9 @@ default group's configuration settings. The values should be name following this
89103
90104As with all other
91105
106+ **********************
92107Explanation of Values:
93- ----------------------
108+ **********************
94109
95110============== ===========================================================================================================
96111 Name Config Description
0 commit comments