From 8d3afcc9694c5442c2bf87ed562b96646deea692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Sat, 1 Dec 2018 17:58:01 +0100 Subject: [PATCH] Add env default processor --- configuration/external_parameters.rst | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/configuration/external_parameters.rst b/configuration/external_parameters.rst index 18cd96e91da..837efaad070 100644 --- a/configuration/external_parameters.rst +++ b/configuration/external_parameters.rst @@ -494,6 +494,46 @@ Symfony provides the following env var processors: .. versionadded:: 4.2 The ``key`` processor was introduced in Symfony 4.2. +``env(default:fallback_param:BAR)`` + Retrieves the value of the parameter ``fallback_param`` when the of the ``BAR`` env var is not available: + + .. configuration-block:: + + .. code-block:: yaml + + # config/services.yaml + parameters: + private_key: '%env(default:raw_key:file:PRIVATE_KEY)%' + raw_key: '%env(PRIVATE_KEY)%' + # if PRIVATE_KEY is not a valid file path, the content of raw_key is returned. + + .. code-block:: xml + + + + + + + %env(default:raw_key:file:PRIVATE_KEY)% + %env(PRIVATE_KEY)% + + + + .. code-block:: php + + // config/services.php + $container->setParameter('private_key', '%env(default:raw_key:file:PRIVATE_KEY)%'); + $container->setParameter('raw_key', '%env(PRIVATE_KEY)%'); + + .. versionadded:: 4.3 + The ``default`` processor was introduced in Symfony 4.3. + It is also possible to combine any number of processors: .. code-block:: yaml