acquia / drupal-recommended-settings

The composer plugin to add Acquia's drupal recommended settings in your drupal project.
6 stars 6 forks source link

Allow customizing location of settings includes files #73

Open rlhawk opened 6 days ago

rlhawk commented 6 days ago

Is your feature request related to a problem? Please describe. The following files are included automatically, if they exist, in acquia-recommended.settings.php:

  1. DRUPAL_ROOT/sites/settings/global.settings.php
  2. DRUPAL_ROOT/sites/SITE_NAME/settings/includes.settings.php
  3. DRUPAL_ROOT/sites/settings/ci.settings.php
  4. DRUPAL_ROOT/sites/SITE_NAME/settings/ci.settings.php
  5. DRUPAL_ROOT/sites/settings/local.settings.php
  6. DRUPAL_ROOT/sites/SITE_NAME/settings/local.settings.php

The paths to these files are hard-coded to be inside the web root directory. Developers may want to customize the location of these files—to store them outside the web root for additional security, for instance—but there's no way to do that without modifying acquia-recommended.settings.php.

Describe the solution you'd like It would be helpful if the location of settings includes files could be customized—by defining a setting in composer.json, perhaps. There would likely need to be two settings: One for the location of global settings files (1, 3, and 5) and another for site-specific settings files (2, 4, and 6). The default locations for the files could be their current locations.

The settings could be defined like this in composer.json:

    "extra": {
        "drupal-recommended-settings": {
            "settings-path-global": "{$drupal_root}/sites/settings",
            "settings-path-site": "{$drupal_root}/sites/{$site_name}/settings"
        },
    }

Describe alternatives you've considered I am currently customizing the paths to the settings includes files by running a script that alters acquia-recommended.settings.php and deletes the files that are created in the webroot. The script is run on composer install and composer update. This feels like a hacky solution, though.

Additional context No other context.

rlhawk commented 4 days ago

I realize that, in addition to being available to the Composer plugin, the settings would need to be available at runtime, within Drupal, so they would also need to be defined somewhere else—in the main settings.php file, perhaps. This whole issue seems to be pretty complex, and unlikely to be implemented, but this issue can be a place to have a discussion about it.