Objective

  1. $GLOBALS['conf']['container_yamls'] allows settings.php to specify additional site-specific service YAML files.

  2. #2241633: Simplify site-specific service overrides removes the need to set that variable, and simply discovers a $conf_path/services.yml file automatically, if it exists.

  3. There is not really a use-case for manually specifying additional service YAML files —

    Except of possibly kernel-environment-specific overrides.

Proposed solution

  1. Remove the global $GLOBALS['conf']['container_yamls'] variable + all references to it (none as of today).

  2. Make DrupalKernel automatically discover a kernel-environment-specific services.$env.yml file, which is able to override the services.yml definitions:

    if (file_exists($site_services_yml = conf_path() . '/services.yml')) {
      $this->serviceYamls['site'][] = $site_services_yml;
    }
    $env = $this->getEnvironment();
    if (file_exists($site_services_yml = conf_path() . "/services.$env.yml")) {
      $this->serviceYamls['site'][] = $site_services_yml;
    }
    

    $conf_path/services.dev.yml adds to or overrides $conf_path/services.yml

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Active » Postponed
sun’s picture

Title: Remove $GLOBALS['conf']['container_yamls'] » Replace $GLOBALS['conf']['container_yamls'] with optional $conf_path/services.$env.yml file

Clarifying issue title.

sun’s picture

Status: Postponed » Needs review
FileSize
775 bytes

Simple. :-)

sun’s picture

One global/settings variable less to document. :-)

sun’s picture

Added test coverage.

This is RTBC from my perspective.

dawehner’s picture

services.$env.yml is certainly a great idea.

One thing we might have to take care about are hosting providers. In HEAD they can just ask people to put that container_yaml bit into the settings file or actually just expose settings.whatever.php for the developer.
With this patch you have just one yml file so it might be problematic to enable memcaching etc. without interact with developer code in git repos.

tstoeckler’s picture

If we stick with this new approach I think this should be postponed on #2229011: Tests are no longer modifiable and the implementation re-considered after that.

Thoughts?

sun’s picture

@dawehner: For hosting providers, we rather want to look into native support for $_ENV (as in upstream), which seemingly is the goal and purpose of #1830816: Support PHP environment-sourced settings/services/configuration via $_ENV


@tstoeckler: Neither this change nor the initial/previous change of #2241633: Simplify site-specific service overrides is related to tests in any way. All site-specific overrides MUST NOT leak into any test environment.

The test change in this patch might have caused confusion — it only exists to prove that a (regular runtime) kernel (re)build does actually consume an additional environment-specific services.$env.yml file from the site directory.

However, this is not meant to be a pattern to override services for test environments. Any attempt to base such a mechanism on this facility here would not work either way, since the kernel environment (intentionally) varies for each test base class.

jibran’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jhedstrom’s picture

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +Needs issue summary update, +Needs reroll

Needs an IS update if there's anything left to be done (the global is gone).

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Going to close as outdated since this has been in PNMI for 6 years without an update

If you feel this is still an issue please reopen. After searching for any duplicates