Skip to content

Provides a way to override cache and log folders from the ENV #13819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2020
Merged
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
17 changes: 12 additions & 5 deletions configuration/override_dir_structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
Expand All @@ -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

Expand All @@ -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
Expand Down