Double integration in settings.php and load.environment.php

Created on 20 March 2024, 9 months ago

Problem/Motivation

In the modules README.md:

In your settings.php file, add the following to the top of the file:

use Symfony\Component\Dotenv\Dotenv;
(new Dotenv())->bootEnv(DRUPAL_ROOT . '/../.env');

On the project page:

copying the load.environment.php file to your project and setting it to autoload using Composer.

Question

Is it really necessary to define both or is one variant sufficient?

🐛 Bug report
Status

Closed: works as designed

Version

1.2

Component

Documentation

Created by

🇨🇭Switzerland handkerchief

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @handkerchief
  • Status changed to Closed: works as designed 9 months ago
  • 🇧🇪Belgium dieterholvoet Brussels

    We used to recommend adding it to settings.php, but we discovered later that by using the load.environment.php method, you could use .env variables in a Drush context as well. So no, both aren't necessary. The current README.md is up to date though, it doesn't mention settings.php anymore. You should update your version of the module.

Production build 0.71.5 2024