You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: user_guide_src/source/general/configuration.rst
+17-6Lines changed: 17 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,20 +65,26 @@ Environment Variables should also be used for anything private such as passwords
65
65
66
66
.. _dotenv-file:
67
67
68
-
Environment Variables and CodeIgniter
69
-
=====================================
68
+
Dotenv File
69
+
===========
70
70
71
71
CodeIgniter makes it simple and painless to set Environment Variables by using a "dotenv" file. The term comes from the file name, which starts with a dot before the text "env".
72
72
73
-
CodeIgniter expects **.env** to be at the root of your project alongside the
74
-
``app`` directories. There is a template file distributed with CodeIgniter that's
75
-
located at the project root named **env** (Notice there's no dot (**.**) at the start?).
73
+
Creating Dotenv File
74
+
--------------------
75
+
76
+
CodeIgniter expects the **.env** file to be at the root of your project alongside the
77
+
**app** directories. There is a template file distributed with CodeIgniter that's
78
+
located at the project root named **env** (Notice there's no dot (``.``) at the start?).
76
79
It has a large collection of variables your project might use that have been assigned
77
80
empty, dummy, or default values. You can use this file as a starting place for your
78
81
application by either renaming the template to **.env**, or by making a copy of it named **.env**.
79
82
80
83
.. important:: Make sure the **.env** file is NOT tracked by your version control system. For *git* that means adding it to **.gitignore**. Failure to do so could result in sensitive credentials being exposed to the public.
81
84
85
+
Setting Variables
86
+
-----------------
87
+
82
88
Settings are stored in **.env** files as a simple a collection of name/value pairs separated by an equal sign.
83
89
::
84
90
@@ -88,7 +94,12 @@ Settings are stored in **.env** files as a simple a collection of name/value pai
88
94
89
95
When your application runs, **.env** will be loaded automatically, and the variables put
90
96
into the environment. If a variable already exists in the environment, it will NOT be
91
-
overwritten. The loaded Environment variables are accessed using any of the following:
97
+
overwritten.
98
+
99
+
Getting Variables
100
+
-----------------
101
+
102
+
The loaded environment variables are accessed using any of the following:
0 commit comments