Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions user_guide_src/source/database/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ within the class' constructor:

.. literalinclude:: configuration/008.php

.. _database-config-with-env-file:

**************************
Configuring with .env File
**************************
Expand Down
6 changes: 6 additions & 0 deletions user_guide_src/source/general/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ are considered for merging into the configuration object's properties.
.. important:: You cannot add a new property by setting environment variables,
nor change a scalar value to an array. See :ref:`env-var-replacements-for-data`.

.. note:: This feature is implemented in the ``CodeIgniter\Config\BaseConfig``
class. So it will not work with a few files in the **app/Config** folder
that do not extends the class.

If the prefix of a namespaced variable exactly matches the namespace of the configuration
class, then the trailing part of the setting (after the dot) is treated as a configuration
property. If it matches an existing configuration property, the environment variable's
Expand Down Expand Up @@ -233,6 +237,8 @@ expect your ``Config\App`` to magically have that property and value at run time
When you have the property ``$default = ['encrypt' => false]`` in your
``Config\Database``, you cannot change the ``encrypt`` value to an array even if
you put ``database.default.encrypt.ssl_verify = true`` in your **.env**.
If you want to do like that, see
:ref:`Database Configuration <database-config-with-env-file>`.

Treating Environment Variables as Arrays
========================================
Expand Down