I was dumbfounded today trying to setup a drupal 8 site on Aegir using the "config_installer" profile. This tool will automatically import the config from the CONFIG_SYNC_DIRECTORY.

I am trying to override the CONFIG_SYNC_DIRECTORY, which in aegir is written into settings.php as sites/DOMAIN.com/files/private/sync.

I tried using local.settings.php to change the sync directory as specified in https://www.drupal.org/docs/8/configuration-management/changing-the-stor...

It would not override the variable listed in the install profile.

I did a print and a die, and it did run, so I knew local.settings.php was being included.

Turns out, it was only being included ONCE. I don't know if it was Drupal 8 itself, or config_installer profile, but settings.php was being bootstrapped TWICE. Meaning, the second time it was NOT including local.settings.php, and was re-overriding my config.

When I changed it to just include, it worked as expected.

Comments

Jon Pugh created an issue. See original summary.

  • Jon Pugh committed 01428af on 2940702-settings-includes
    Issue #2940702: Unable to override Drupal 8 "synchronization" directory...
helmo’s picture

Title: Unable to override Drupal 8 "synchronization" directory in local.settings.php » Unable to override Drupal 8 in local.settings.php

When setttings.php is being included twice this would hold for any config option. So updating the title.

D8 seems to have changed this to 'require' in core/lib/Drupal/Core/Site/Settings.php#n114

D7 has it in drupal_settings_initialize and does an include_once. And D6 does it the same way. So I'd vote to not change anything for those templates.

Jon Pugh’s picture

Thanks for looking into this, Herman.

That makes sense. I'll revert the changes to the pre 8 templates.

Jon Pugh’s picture

New branch pushed with a single commit for Drupal 8 template.

  • Jon Pugh committed e79524c on 2940702-settings-includes
    Issue #2940702 by Jon Pugh: Unable to override Drupal 8 in local....

  • Jon Pugh committed e79524c on 7.x-3.x
    Issue #2940702 by Jon Pugh: Unable to override Drupal 8 in local....
  • helmo committed fd9904a on 7.x-3.x
    Issue #2940702: Merge remote-tracking branch 'origin/2940702-settings-...
helmo’s picture

Status: Needs review » Fixed

merged, thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.