diff --git a/configuration/external_parameters.rst b/configuration/external_parameters.rst index bafbfd86662..bf17c3f2cf4 100644 --- a/configuration/external_parameters.rst +++ b/configuration/external_parameters.rst @@ -453,6 +453,47 @@ Symfony provides the following env var processors: 'auth' => '%env(file:AUTH_FILE)%', )); +``env(key:FOO:BAR)`` + Retrieves the value associated with the key ``FOO`` from the array whose + contents are stored in the ``BAR`` env var: + + .. configuration-block:: + + .. code-block:: yaml + + # config/services.yaml + parameters: + env(SECRETS_FILE): '/opt/application/.secrets.json' + database_password: '%env(key:database_password:json:file:SECRETS_FILE)%' + # if SECRETS_FILE contents are: {"database_password": "secret"} it returns "secret" + + .. code-block:: xml + + + + + + + /opt/application/.secrets.json + %env(key:database_password:json:file:SECRETS_FILE)% + + + + .. code-block:: php + + // config/services.php + $container->setParameter('env(SECRETS_FILE)', '/opt/application/.secrets.json'); + $container->setParameter('database_password', '%env(key:database_password:json:file:SECRETS_FILE)%'); + + .. versionadded:: 4.2 + The ``key`` processor was introduced in Symfony 4.2. + It is also possible to combine any number of processors: .. code-block:: yaml