From 72a1d16ad780092c2070711d40e18d192037f96a Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 15 Sep 2023 16:22:28 +0900 Subject: [PATCH 1/2] docs: add note for feature to replace Config property --- user_guide_src/source/general/configuration.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index e51ab1e8fa40..4e8c2940d996 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -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 From b63b6253f24f363ff742c3a7497dd2012324feda Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 15 Sep 2023 16:24:57 +0900 Subject: [PATCH 2/2] docs: add link to how-to page --- user_guide_src/source/database/configuration.rst | 2 ++ user_guide_src/source/general/configuration.rst | 2 ++ 2 files changed, 4 insertions(+) diff --git a/user_guide_src/source/database/configuration.rst b/user_guide_src/source/database/configuration.rst index b80c10ede526..128e28d9eeef 100644 --- a/user_guide_src/source/database/configuration.rst +++ b/user_guide_src/source/database/configuration.rst @@ -105,6 +105,8 @@ within the class' constructor: .. literalinclude:: configuration/008.php +.. _database-config-with-env-file: + ************************** Configuring with .env File ************************** diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index 4e8c2940d996..45ecce84108d 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -237,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 `. Treating Environment Variables as Arrays ========================================