diff --git a/configuration/external_parameters.rst b/configuration/external_parameters.rst index 5dfcbb4d50f..bf17c3f2cf4 100644 --- a/configuration/external_parameters.rst +++ b/configuration/external_parameters.rst @@ -454,13 +454,42 @@ Symfony provides the following env var processors: )); ``env(key:FOO:BAR)`` - Retrieves key ``FOO`` from array value ``BAR``: + Retrieves the value associated with the key ``FOO`` from the array whose + contents are stored in the ``BAR`` env var: - .. code-block:: yaml + .. configuration-block:: - parameters: - env(APP_SECRETS): "{\"database_password\": \"secret\"}" - database_password: '%env(key:database_password:json:APP_SECRETS)%' + .. 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.