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