@@ -624,6 +624,59 @@ Symfony provides the following env var processors:
624624
625625 The ``query_string `` processor was introduced in Symfony 4.3.
626626
627+ ``env(secret:FOO) ``
628+ Reads a secret value stored in the app's vault, :ref: `see how to set Secrets<secrets-set> `.
629+
630+ .. code-block :: terminal
631+
632+ $ php bin/console secrets:set DATABASE_PASSWORD -
633+
634+ .. configuration-block ::
635+
636+ .. code-block :: yaml
637+
638+ # config/packages/database.yaml
639+ doctrine :
640+ dbal :
641+ # by convention the env var names are always uppercase
642+ url : ' %env(DATABASE_URL)%'
643+ password : ' %env(secret:DATABASE_PASSWORD)%'
644+
645+ .. code-block :: xml
646+
647+ <!-- config/packages/doctrine.xml -->
648+ <?xml version="1.0" encoding="UTF-8" ?>
649+ <container xmlns="http://symfony.com/schema/dic/services"
650+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
651+ xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
652+ xsi:schemaLocation="http://symfony.com/schema/dic/services
653+ https://symfony.com/schema/dic/services/services-1.0.xsd
654+ http://symfony.com/schema/dic/doctrine
655+ https://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd">
656+
657+ <doctrine:config>
658+ <!-- by convention the env var names are always uppercase -->
659+ <doctrine:dbal url="%env(DATABASE_URL)%" password="%env(secret:DATABASE_PASSWORD)%"/>
660+ </doctrine:config>
661+
662+ </container>
663+
664+ .. code-block :: php
665+
666+ // config/packages/doctrine.php
667+ $container->loadFromExtension('doctrine', [
668+ 'dbal' => [
669+ // by convention the env var names are always uppercase
670+ 'url' => '%env(DATABASE_URL)%',
671+ 'password' => '%env(secret:DATABASE_PASSWORD)%',
672+ ]
673+ ]);
674+
675+
676+ .. versionadded :: 4.4
677+
678+ The ``secret `` processor was introduced in Symfony 4.4.
679+
627680It is also possible to combine any number of processors:
628681
629682.. code-block :: yaml
0 commit comments