Skip to content

Commit

Permalink
fix(drupal-php): ensure ENVIRONMENT_NAME is present in settings.php
Browse files Browse the repository at this point in the history
  • Loading branch information
esolitos authored Sep 19, 2023
1 parent 7bf4426 commit 9355547
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion templates/drupal-php/default.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@
*/
$settings_file = __DIR__ . "/settings.{$ENV_TYPE}.php";
file_exists($settings_file) && include $settings_file;
if ($_SERVER['ENVIRONMENT_NAME']) {
if (!empty($_SERVER['ENVIRONMENT_NAME'])) {
$settings_file = __DIR__ . "/settings.{$_SERVER['ENVIRONMENT_NAME']}.php";
file_exists($settings_file) && include $settings_file;
}

/**
* Load environment based override configuration.
*/
if (file_exists($app_root . '/' . $site_path . '/settings.env.php')) {
include $app_root . '/' . $site_path . '/settings.env.php';
}

/*
* Lastly when we use containers based on the wodby/drupal-php base image some configuration is auto-generated based on environment variables.
* This file is generated in $CONF_DIR/wodby.settings.php, so we check if this file exists and in this case we include it to set the defaults.
Expand All @@ -36,3 +43,8 @@
$settings_file = "{$_SERVER['CONF_DIR']}/wodby.settings.php";
file_exists($settings_file) && include $settings_file;
}

/**
* Ensure location of the site configuration files.
*/
$settings["config_sync_directory"] = dirname(DRUPAL_ROOT) . '/config/common/';

0 comments on commit 9355547

Please sign in to comment.