According to the Symfony documentation, env() parameters were introduced in version 3.2, allowing to use environment variables in service container configuration:

# app/config/config.yml
        host: '%env(DATABASE_HOST)%'

However, when I try using this functionality in Drupal I get an exception stating:

The service XXX has a dependency on a non-existent parameter "env(DATABASE_HOST)"

Looking at the stack trace I only see references to the default ResolveParameterPlaceholdersPass and not to ResolveEnvPlaceholdersPass

I'm using Drupal 8.6.5 which uses symfony/dependency-injection v3.4.20

closed as off-topic by mradcliffe, Pierre.Vriens, leymannx, sanzante, DRUPWAY Jan 14 at 8:09

  • This question does not appear to be about Drupal within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Maybe I don't understand well, but why don't use .env file provided by Drupal ? – Hassan Gouzoul Jan 4 at 17:12
  • Good question. I'm not sure if it's supported or not. – mradcliffe Jan 4 at 18:44
  • 2
    This isn't supported. Here's a link to a "Plan" issue meaning it's an idea on maybe implementing it: drupal.org/project/drupal/issues/2879846 – mradcliffe Jan 4 at 18:52

Browse other questions tagged or ask your own question.