@@ -494,6 +494,46 @@ Symfony provides the following env var processors:
494494 .. versionadded :: 4.2
495495 The ``key `` processor was introduced in Symfony 4.2.
496496
497+ ``env(default:fallback_param:BAR) ``
498+ Retrieves the value of the parameter ``fallback_param `` when the of the ``BAR `` env var is not available:
499+
500+ .. configuration-block ::
501+
502+ .. code-block :: yaml
503+
504+ # config/services.yaml
505+ parameters :
506+ private_key : ' %env(default:raw_key:file:PRIVATE_KEY)%'
507+ raw_key : ' %env(PRIVATE_KEY)%'
508+ # if PRIVATE_KEY is not a valid file path, the content of raw_key is returned.
509+
510+ .. code-block :: xml
511+
512+ <!-- config/services.xml -->
513+ <?xml version =" 1.0" encoding =" UTF-8" ?>
514+ <container xmlns =" http://symfony.com/schema/dic/services"
515+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
516+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
517+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
518+ http://symfony.com/schema/dic/services/services-1.0.xsd
519+ http://symfony.com/schema/dic/symfony
520+ http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
521+
522+ <parameters >
523+ <parameter key =" private_key" >%env(default:raw_key:file:PRIVATE_KEY)%</parameter >
524+ <parameter key =" raw_key" >%env(PRIVATE_KEY)%</parameter >
525+ </parameters >
526+ </container >
527+
528+ .. code-block :: php
529+
530+ // config/services.php
531+ $container->setParameter('private_key', '%env(default:raw_key:file:PRIVATE_KEY)%');
532+ $container->setParameter('raw_key', '%env(PRIVATE_KEY)%');
533+
534+ .. versionadded :: 4.3
535+ The ``default `` processor was introduced in Symfony 4.3.
536+
497537It is also possible to combine any number of processors:
498538
499539.. code-block :: yaml
0 commit comments