From 88b081c1c7b80d22e54301d9eda5866bac097977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morel=20Se=CC=81bastien?= Date: Thu, 11 Jun 2020 12:36:17 -0700 Subject: [PATCH] Provides a way to override cache and log folders from the ENV --- configuration/override_dir_structure.rst | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/configuration/override_dir_structure.rst b/configuration/override_dir_structure.rst index fbfa119cc14..f06d55c913b 100644 --- a/configuration/override_dir_structure.rst +++ b/configuration/override_dir_structure.rst @@ -41,8 +41,8 @@ at your project root directory. Override the Cache Directory ---------------------------- -You can change the default cache directory by overriding the ``getCacheDir()`` -method in the ``Kernel`` class of your application:: +Changing the cache directory can be achieved by overriding the +``getCacheDir()`` method in the ``Kernel`` class of your application:: // src/Kernel.php @@ -61,6 +61,9 @@ In this code, ``$this->environment`` is the current environment (i.e. ``dev``). In this case you have changed the location of the cache directory to ``var/{environment}/cache/``. +This can also be achieved using a predefined environment variable named +``APP_CACHE_DIR``. Its value must be the full path of the cache folder. + .. caution:: You should keep the cache directory different for each environment, @@ -73,9 +76,11 @@ In this case you have changed the location of the cache directory to Override the Log Directory -------------------------- -Overriding the ``var/log/`` directory is the same as overriding the ``var/cache/`` -directory. The only difference is that you need to override the ``getLogDir()`` -method:: +Overriding the ``var/log/`` directory is almost the same as overriding the +``var/cache/`` directory. + +You can do it overriding the ``getLogDir()`` method in the ``Kernel`` class of +your application:: // src/Kernel.php @@ -92,6 +97,8 @@ method:: Here you have changed the location of the directory to ``var/{environment}/log/``. +And you can also do it using the predefined ``APP_LOG_DIR`` environment variable. + .. _override-templates-dir: Override the Templates Directory