@@ -454,13 +454,42 @@ Symfony provides the following env var processors:
454454 ));
455455
456456 ``env(key:FOO:BAR) ``
457- Retrieves key ``FOO `` from array value ``BAR ``:
457+ Retrieves the value associated with the key ``FOO `` from the array whose
458+ contents are stored in the ``BAR `` env var:
458459
459- .. code -block :: yaml
460+ .. configuration -block ::
460461
461- parameters :
462- env(APP_SECRETS) : " {\" database_password\" : \" secret\" }"
463- database_password : ' %env(key:database_password:json:APP_SECRETS)%'
462+ .. code-block :: yaml
463+
464+ # config/services.yaml
465+ parameters :
466+ env(SECRETS_FILE) : ' /opt/application/.secrets.json'
467+ database_password : ' %env(key:database_password:json:file:SECRETS_FILE)%'
468+ # if SECRETS_FILE contents are: {"database_password": "secret"} it returns "secret"
469+
470+ .. code-block :: xml
471+
472+ <!-- config/services.xml -->
473+ <?xml version =" 1.0" encoding =" UTF-8" ?>
474+ <container xmlns =" http://symfony.com/schema/dic/services"
475+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
476+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
477+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
478+ http://symfony.com/schema/dic/services/services-1.0.xsd
479+ http://symfony.com/schema/dic/symfony
480+ http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
481+
482+ <parameters >
483+ <parameter key =" env(SECRETS_FILE)" >/opt/application/.secrets.json</parameter >
484+ <parameter key =" database_password" >%env(key:database_password:json:file:SECRETS_FILE)%</parameter >
485+ </parameters >
486+ </container >
487+
488+ .. code-block :: php
489+
490+ // config/services.php
491+ $container->setParameter('env(SECRETS_FILE)', '/opt/application/.secrets.json');
492+ $container->setParameter('database_password', '%env(key:database_password:json:file:SECRETS_FILE)%');
464493
465494 .. versionadded :: 4.2
466495 The ``key `` processor was introduced in Symfony 4.2.
0 commit comments