From c8ad2964c16e58256eeb14a1fa91f6687b74c931 Mon Sep 17 00:00:00 2001 From: fmata Date: Sun, 8 Apr 2018 13:13:32 +0200 Subject: [PATCH 1/4] Update dotenv.rst --- components/dotenv.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/dotenv.rst b/components/dotenv.rst index fae35a5b5f2..01c324291f9 100644 --- a/components/dotenv.rst +++ b/components/dotenv.rst @@ -58,9 +58,8 @@ Access the value with ``getenv()`` in your code:: $dbUser = getenv('DB_USER'); // you can also use ``$_ENV`` or ``$_SERVER`` -.. note:: - - Symfony Dotenv never overwrites existing environment variables. +.. versionadded:: 4.1 + Passing ``true`` in ``Dotenv(true)`` constructor allow you to overwrite existing environment variables. You should never store a ``.env`` file in your code repository as it might contain sensitive information; create a ``.env.dist`` file with sensible From 63257596de58fbc4ad5c248b03a8fa019a00a3b3 Mon Sep 17 00:00:00 2001 From: fmata Date: Mon, 9 Jul 2018 17:43:20 +0200 Subject: [PATCH 2/4] Update dotenv.rst --- components/dotenv.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/dotenv.rst b/components/dotenv.rst index 01c324291f9..9ebbbbcecb1 100644 --- a/components/dotenv.rst +++ b/components/dotenv.rst @@ -58,8 +58,8 @@ Access the value with ``getenv()`` in your code:: $dbUser = getenv('DB_USER'); // you can also use ``$_ENV`` or ``$_SERVER`` -.. versionadded:: 4.1 - Passing ``true`` in ``Dotenv(true)`` constructor allow you to overwrite existing environment variables. +.. versionadded:: 4.2 + Passing ``true`` in ``Dotenv()`` constructor allow you to overwrite existing environment variables. You should never store a ``.env`` file in your code repository as it might contain sensitive information; create a ``.env.dist`` file with sensible From f8a3c0d3410a8d3ef57a12a619141a03be644b95 Mon Sep 17 00:00:00 2001 From: fmata Date: Tue, 4 Sep 2018 17:44:22 +0200 Subject: [PATCH 3/4] Update dotenv.rst --- components/dotenv.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dotenv.rst b/components/dotenv.rst index 9ebbbbcecb1..35dbd1edbcb 100644 --- a/components/dotenv.rst +++ b/components/dotenv.rst @@ -59,7 +59,7 @@ Access the value with ``getenv()`` in your code:: // you can also use ``$_ENV`` or ``$_SERVER`` .. versionadded:: 4.2 - Passing ``true`` in ``Dotenv()`` constructor allow you to overwrite existing environment variables. + Passing ``$overrideExistingVars`` as ``true`` in ``Dotenv::populate()`` or calling ``Dotenv::overload()`` instead of ``Dotenv::load()`` allow you to overwrite existing environment variables. You should never store a ``.env`` file in your code repository as it might contain sensitive information; create a ``.env.dist`` file with sensible From 38e4f08c0ec8aac80fd8be5f6f3c1814598d810d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 4 Sep 2018 17:56:40 +0200 Subject: [PATCH 4/4] Reword --- components/dotenv.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/dotenv.rst b/components/dotenv.rst index 35dbd1edbcb..daa0a197441 100644 --- a/components/dotenv.rst +++ b/components/dotenv.rst @@ -58,8 +58,14 @@ Access the value with ``getenv()`` in your code:: $dbUser = getenv('DB_USER'); // you can also use ``$_ENV`` or ``$_SERVER`` +The ``load()`` method never overwrites existing environment variables. Use the +``overload()`` method if you need to overwrite them:: + + // ... + $dotenv->overload(__DIR__.'/.env'); + .. versionadded:: 4.2 - Passing ``$overrideExistingVars`` as ``true`` in ``Dotenv::populate()`` or calling ``Dotenv::overload()`` instead of ``Dotenv::load()`` allow you to overwrite existing environment variables. + The ``Dotenv::overload()`` method was introduced in Symfony 4.2. You should never store a ``.env`` file in your code repository as it might contain sensitive information; create a ``.env.dist`` file with sensible