From c7f74a7e8a85b3a759b6753e15a84baa83642b90 Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Sat, 17 Aug 2024 06:59:19 +1000 Subject: [PATCH] [#1353] Removed `$LAGOON_ENVIRONMENT_TYPE` from `docker-compose.yml`. --- .../bats/fixtures/docker-compose.env.json | 7 -- .../fixtures/docker-compose.env_local.json | 7 -- .../bats/fixtures/docker-compose.env_mod.json | 7 -- .../bats/fixtures/docker-compose.noenv.json | 7 -- docker-compose.yml | 4 - .../Drupal/EnvironmentSettingsTest.php | 93 ++++++++++++++----- .../includes/providers/settings.acquia.php | 5 + .../includes/providers/settings.lagoon.php | 23 ++--- 8 files changed, 86 insertions(+), 67 deletions(-) diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env.json b/.scaffold/tests/bats/fixtures/docker-compose.env.json index f22922e4b..2ce744e55 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env.json @@ -31,7 +31,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -78,7 +77,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -127,7 +125,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -183,7 +180,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -240,7 +236,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -303,7 +298,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -376,7 +370,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env_local.json b/.scaffold/tests/bats/fixtures/docker-compose.env_local.json index f22922e4b..2ce744e55 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env_local.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env_local.json @@ -31,7 +31,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -78,7 +77,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -127,7 +125,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -183,7 +180,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -240,7 +236,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -303,7 +298,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -376,7 +370,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", diff --git a/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json b/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json index b9dd25ee0..549e95c5d 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.env_mod.json @@ -31,7 +31,6 @@ "DRUPAL_SHIELD_PASS": "passw", "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "development", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -78,7 +77,6 @@ "DRUPAL_SHIELD_PASS": "passw", "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "development", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -127,7 +125,6 @@ "DRUPAL_SHIELD_PASS": "passw", "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "development", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -183,7 +180,6 @@ "DRUPAL_SHIELD_PASS": "passw", "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "development", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -240,7 +236,6 @@ "DRUPAL_SHIELD_PASS": "passw", "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "development", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -303,7 +298,6 @@ "DRUPAL_SHIELD_PASS": "passw", "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "development", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -376,7 +370,6 @@ "DRUPAL_SHIELD_PASS": "passw", "DRUPAL_SHIELD_USER": "jane", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "development", "LAGOON_ROUTE": "the_matrix.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", diff --git a/.scaffold/tests/bats/fixtures/docker-compose.noenv.json b/.scaffold/tests/bats/fixtures/docker-compose.noenv.json index f974d07e0..8e0cff2b9 100644 --- a/.scaffold/tests/bats/fixtures/docker-compose.noenv.json +++ b/.scaffold/tests/bats/fixtures/docker-compose.noenv.json @@ -31,7 +31,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -78,7 +77,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -127,7 +125,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -183,7 +180,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -240,7 +236,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -303,7 +298,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", @@ -376,7 +370,6 @@ "DRUPAL_SHIELD_PASS": "", "DRUPAL_SHIELD_USER": "", "DRUPAL_TEMPORARY_FILES": "/tmp", - "LAGOON_ENVIRONMENT_TYPE": "local", "LAGOON_ROUTE": "star_wars.docker.amazee.io", "MARIADB_DATABASE": "drupal", "MARIADB_HOST": "mariadb", diff --git a/docker-compose.yml b/docker-compose.yml index ebed40d2f..76762664f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -75,10 +75,6 @@ x-environment: &default-environment # Redis integration flag. DRUPAL_REDIS_ENABLED: ${DRUPAL_REDIS_ENABLED:-} #;> REDIS - #;< LAGOON - # Lagoon environment type. - LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-local} - #;> LAGOON # ------------------------------------------------------------------------------ # Services. diff --git a/tests/phpunit/Drupal/EnvironmentSettingsTest.php b/tests/phpunit/Drupal/EnvironmentSettingsTest.php index 271779723..e8ec6c115 100644 --- a/tests/phpunit/Drupal/EnvironmentSettingsTest.php +++ b/tests/phpunit/Drupal/EnvironmentSettingsTest.php @@ -31,7 +31,7 @@ public function testEnvironmentTypeResolution(array $vars, string $expected_env) $this->requireSettingsFile(); - $this->assertEquals($expected_env, $this->settings['environment']); + $this->assertEquals($expected_env, $this->settings['environment'], print_r($vars, TRUE)); } /** @@ -95,31 +95,76 @@ public function dataProviderEnvironmentTypeResolution(): array { // Lagoon. [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, ], - static::ENVIRONMENT_LOCAL, + static::ENVIRONMENT_DEV, ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'production', ], static::ENVIRONMENT_PROD, ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_GIT_BRANCH' => 'main', 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => 'main', 'LAGOON_ENVIRONMENT_TYPE' => 'development', ], static::ENVIRONMENT_PROD, ], + [ + [ + 'LAGOON_KUBERNETES' => 1, + 'LAGOON_GIT_BRANCH' => 'main', + 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => 'master', + 'LAGOON_ENVIRONMENT_TYPE' => 'development', + ], + static::ENVIRONMENT_TEST, + ], + [ + [ + 'LAGOON_KUBERNETES' => 1, + 'LAGOON_GIT_BRANCH' => 'master', + 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => FALSE, + 'LAGOON_ENVIRONMENT_TYPE' => 'development', + ], + static::ENVIRONMENT_TEST, + ], + [ + [ + 'LAGOON_KUBERNETES' => 1, + 'LAGOON_GIT_BRANCH' => 'master', + 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => FALSE, + 'LAGOON_ENVIRONMENT_TYPE' => 'production', + ], + static::ENVIRONMENT_PROD, + ], + [ + [ + 'LAGOON_KUBERNETES' => 1, + 'LAGOON_GIT_BRANCH' => 'main', + 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => FALSE, + 'LAGOON_ENVIRONMENT_TYPE' => 'development', + ], + static::ENVIRONMENT_TEST, + ], + [ + [ + 'LAGOON_KUBERNETES' => 1, + 'LAGOON_GIT_BRANCH' => 'main', + 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => FALSE, + 'LAGOON_ENVIRONMENT_TYPE' => 'production', + ], + static::ENVIRONMENT_PROD, + ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => 'release', ], @@ -127,7 +172,7 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => 'release/1.2.3', ], @@ -135,7 +180,7 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => 'hotfix', ], @@ -143,7 +188,7 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => 'hotfix/1.2.3', ], @@ -152,7 +197,7 @@ public function dataProviderEnvironmentTypeResolution(): array { [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => FALSE, ], @@ -160,7 +205,7 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => FALSE, ], @@ -168,7 +213,7 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => FALSE, 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => FALSE, @@ -177,7 +222,7 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => 'somebranch', 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => FALSE, @@ -186,7 +231,7 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => FALSE, 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => 'otherbranch', @@ -195,7 +240,7 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => 'somebranch', 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => 'otherbranch', @@ -204,7 +249,7 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_GIT_BRANCH' => '', 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => '', @@ -213,16 +258,16 @@ public function dataProviderEnvironmentTypeResolution(): array { ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', - 'LAGOON_GIT_BRANCH' => 'somebranch', - 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => 'somebranch', + 'LAGOON_GIT_BRANCH' => 'mainbranch', + 'DREVOPS_LAGOON_PRODUCTION_BRANCH' => 'mainbranch', ], static::ENVIRONMENT_PROD, ], [ [ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', ], static::ENVIRONMENT_DEV, @@ -538,7 +583,7 @@ public function testEnvironmentAcquiaProd(): void { */ public function testEnvironmentLagoonDynamic(): void { $this->setEnvVars([ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_ROUTES' => 'http://example1.com,https://example2/com', 'LAGOON_PROJECT' => 'test_project', @@ -590,7 +635,7 @@ public function testEnvironmentLagoonDynamic(): void { */ public function testEnvironmentLagoonDev(): void { $this->setEnvVars([ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_ROUTES' => 'http://example1.com,https://example2/com', 'LAGOON_PROJECT' => 'test_project', @@ -642,7 +687,7 @@ public function testEnvironmentLagoonDev(): void { */ public function testEnvironmentLagoonTest(): void { $this->setEnvVars([ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'development', 'LAGOON_ROUTES' => 'http://example1.com,https://example2/com', 'LAGOON_PROJECT' => 'test_project', @@ -694,7 +739,7 @@ public function testEnvironmentLagoonTest(): void { */ public function testEnvironmentLagoonProd(): void { $this->setEnvVars([ - 'LAGOON' => 1, + 'LAGOON_KUBERNETES' => 1, 'LAGOON_ENVIRONMENT_TYPE' => 'production', 'LAGOON_ROUTES' => 'http://example1.com,https://example2/com', 'LAGOON_PROJECT' => 'test_project', diff --git a/web/sites/default/includes/providers/settings.acquia.php b/web/sites/default/includes/providers/settings.acquia.php index 76db016c9..32d408e91 100644 --- a/web/sites/default/includes/providers/settings.acquia.php +++ b/web/sites/default/includes/providers/settings.acquia.php @@ -4,6 +4,11 @@ * @file * Acquia hosting provider settings. * + * Do not place any custom settings in this file. + * It is used to explicitly map Acquia environments to $settings['environment'] + * and set platform-specific settings only. + * Instead, use per-module settings files. + * * @see https://docs.acquia.com/acquia-cloud/develop/env-variable */ diff --git a/web/sites/default/includes/providers/settings.lagoon.php b/web/sites/default/includes/providers/settings.lagoon.php index 991d1131e..a890f308d 100644 --- a/web/sites/default/includes/providers/settings.lagoon.php +++ b/web/sites/default/includes/providers/settings.lagoon.php @@ -3,32 +3,31 @@ /** * @file * Lagoon hosting provider settings. + * + * Do not place any custom settings in this file. + * It is used to explicitly map Lagoon environments to $settings['environment'] + * and set platform-specific settings only. + * Instead, use per-module settings files. */ declare(strict_types=1); -if (getenv('LAGOON') && getenv('LAGOON_ENVIRONMENT_TYPE') == 'production' || getenv('LAGOON_ENVIRONMENT_TYPE') == 'development') { - // Do not put any Lagoon-specific settings in this code block. It is used - // to explicitly map Lagoon environments to $settings['environment'] - // variable only. - // Instead, use 'PER-ENVIRONMENT SETTINGS' section below. - // +if (!empty(getenv('LAGOON_KUBERNETES'))) { // Environment is marked as 'production' in Lagoon. if (getenv('LAGOON_ENVIRONMENT_TYPE') == 'production') { $settings['environment'] = ENVIRONMENT_PROD; } - // All other environments running in Lagoon are considered 'development'. else { - // Any other environment is considered 'development' in Lagoon. + // All other environments running in Lagoon are considered 'development'. $settings['environment'] = ENVIRONMENT_DEV; - // But try to identify production environment using a branch name for - // the cases when 'production' Lagoon environment is not provisioned yet. + // Try to identify production environment using a branch name for + // the cases when the Lagoon environment is not marked as 'production' yet. if (!empty(getenv('LAGOON_GIT_BRANCH')) && !empty(getenv('DREVOPS_LAGOON_PRODUCTION_BRANCH')) && getenv('LAGOON_GIT_BRANCH') === getenv('DREVOPS_LAGOON_PRODUCTION_BRANCH')) { $settings['environment'] = ENVIRONMENT_PROD; } // Dedicated test environment based on a branch name. - elseif (getenv('LAGOON_GIT_BRANCH') == 'master') { + elseif (getenv('LAGOON_GIT_BRANCH') == 'main' || getenv('LAGOON_GIT_BRANCH') == 'master') { $settings['environment'] = ENVIRONMENT_TEST; } // Test environment based on a branch prefix for release and @@ -52,6 +51,8 @@ $settings['cache_prefix']['default'] = (getenv('LAGOON_PROJECT') ?: getenv('DREVOPS_PROJECT')) . '_' . (getenv('LAGOON_GIT_SAFE_BRANCH') ?: getenv('DREVOPS_LAGOON_PRODUCTION_BRANCH')); // Trusted host patterns for Lagoon internal routes. + // Do not modify this section. Instead, add your custom patterns to the + // settings.php file. // URL when accessed from PHP processes in Lagoon. $settings['trusted_host_patterns'][] = '^nginx\-php$'; // Lagoon URL.