From 992a8ef46918b6a20431a6f9d41ee8a9f3997468 Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Thu, 20 Apr 2017 14:42:37 -0700 Subject: [PATCH] Minor refactor of config settings logic. --- settings/config.settings.php | 43 +++++++++--------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/settings/config.settings.php b/settings/config.settings.php index 3d4b7450a..90404149c 100644 --- a/settings/config.settings.php +++ b/settings/config.settings.php @@ -5,56 +5,35 @@ $config_directories['sync'] = $dir . "/config/$site_dir"; $split_filename_prefix = 'config_split.config_split'; $split_filepath_prefix = $config_directories['sync'] . '/' . $split_filename_prefix; - +$split_envs = array('local', 'dev', 'stage', 'prod', 'ci', 'ah_other'); // Ensure the appropriate config split is enabled. -$config['config_split.config_split.local']['status'] = FALSE; -$config['config_split.config_split.dev']['status'] = FALSE; -$config['config_split.config_split.stage']['status'] = FALSE; -$config['config_split.config_split.prod']['status'] = FALSE; -$config['config_split.config_split.ci']['status'] = FALSE; -$config['config_split.config_split.ah_other']['status'] = FALSE; - +foreach ($split_envs as $split_env) { + $config["$split_filename_prefix.$split_env"]['status'] = FALSE; +} +$split = 'none'; // Non-acquia envs. if ($is_local_env) { + $split = 'local'; if (getenv('TRAVIS') || getenv('PIPELINE_ENV')) { $split = 'ci'; - if (file_exists("$split_filepath_prefix.$split.yml")) { - $config["$split_filename_prefix.$split"]['status'] = TRUE; - } - } - else { - $split = 'local'; - if (file_exists("$split_filepath_prefix.$split.yml")) { - $config["$split_filename_prefix.$split"]['status'] = TRUE; - } } } // Acquia only envs. elseif ($is_ah_env) { $config_directories['vcs'] = $config_directories['sync']; + $split = 'ah_other'; if ($is_ah_dev_env) { $split = 'dev'; - if (file_exists("$split_filepath_prefix.$split.yml")) { - $config["$split_filename_prefix.$split"]['status'] = TRUE; - } } elseif ($is_ah_stage_env) { $split = 'stage'; - if (file_exists("$split_filepath_prefix.$split.yml")) { - $config["$split_filename_prefix.$split"]['status'] = TRUE; - } } elseif ($is_ah_prod_env) { $split = 'prod'; - if (file_exists("$split_filepath_prefix.$split.yml")) { - $config["$split_filename_prefix.$split"]['status'] = TRUE; - } - } - else { - $split = 'ah_other'; - if (file_exists("$split_filepath_prefix.$split.yml")) { - $config["$split_filename_prefix.$split"]['status'] = TRUE; - } } } + +if ($split != 'none' && file_exists("$split_filepath_prefix.$split.yml")) { + $config["$split_filename_prefix.$split"]['status'] = TRUE; +}