acquia / drupal-environment-detector

Provides common methods for detecting the current Acquia environment
GNU General Public License v2.0
10 stars 13 forks source link

Better support for ACSF environments #80

Open japerry opened 6 months ago

japerry commented 6 months ago

Is your feature request related to a problem? Please describe. Currently the ACSF detector looks for the multisite config json file. While that is fine for detecting the presence of ACSF, we need more information to know what ACSF environment we are on.

Specifically -- ACSF has an update process that will move production environments to an update environment while the sites are being updated. For quick, small number of sites this is fine; but for larger platforms, or when an error occurs and the production environment is stuck in the update environment, we need to know the correct variable name.

For instance, isAhProdEnv would return false for sites undergoing update, which is not correct. But instead of hard coding update01 via regex, we should be looking for the presence of gardens_site_settings and use those values instead. For example:

    // ACSF Sites should use the pre-configured env and db roles instead.
    if (isset($GLOBALS['gardens_site_settings'])) {
      $ahEnv = $GLOBALS['gardens_site_settings']['env'];
      $ahDbRole = $GLOBALS['gardens_site_settings']['conf']['acsf_db_name'];
    }

We're looking at integrating the environment detector into Acquia Connector and Search so we aren't duplicating logic that this library has, but we will need to make changes here (and have a release) before we can rely on this library in this module. Making an issue here so we can track it for a PR later down the road.