diff --git a/configuration/environment_variables.rst b/configuration/environment_variables.rst index 50a2bd77daf..ee3718f5b28 100644 --- a/configuration/environment_variables.rst +++ b/configuration/environment_variables.rst @@ -354,6 +354,47 @@ Symfony provides the following env var processors: 'trusted_hosts' => '%env(json:TRUSTED_HOSTS)%', ]); +``env(yaml:FOO)`` + Decodes the content of ``FOO``, which is a YAML encoded string. It returns + either an array or ``null``. Mostly useful in combination with + ``file``: + + .. code-block:: yaml + + # config/services.yaml + parameters: + env(SECRETS_FILE): '/opt/application/.secrets.yaml' + database_password: '%env(key:database_password:yaml:file:SECRETS_FILE)%' + # if SECRETS_FILE contents are: 'database_password: secret' it returns "secret" + + .. code-block:: xml + + + + + + + /opt/application/.secrets.yaml + %env(key:database_password:yaml:file:SECRETS_FILE)% + + + + .. code-block:: php + + // config/services.php + $container->setParameter('env(SECRETS_FILE)', '/opt/application/.secrets.yaml'); + $container->setParameter('database_password', '%env(key:database_password:yaml:file:SECRETS_FILE)%'); + + .. versionadded:: 4.3 + + The ``yaml`` processor was introduced in Symfony 4.3. + ``env(resolve:FOO)`` Replaces the string ``FOO`` by the value of a config parameter with the same name: