Skip to content

Commit

Permalink
Added support for DATABASE_DATABASE DB name in settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Jan 31, 2025
1 parent 10fa3ec commit a4668c7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .vortex/docs/.utils/variables/extra/lagoon.variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Additional environment variables used in this project in the Lagoon environment.
# shellcheck disable=SC2034

# Database name.
DATABASE_DATABASE=

# Enable New Relic in Lagoon environment.
#
# Set as project-wide variable.
Expand Down
8 changes: 8 additions & 0 deletions .vortex/docs/content/workflows/variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ Default value: `UNDEFINED`

Defined in: `ENVIRONMENT`

### `DATABASE_DATABASE`

Database name.

Default value: `UNDEFINED`

Defined in: `LAGOON ENVIRONMENT`

### `DATABASE_HOST`

Local database host.
Expand Down
23 changes: 23 additions & 0 deletions tests/phpunit/Drupal/DatabaseSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,29 @@ public static function dataProviderDatabases(): array {
],
],
],

[
[
'DATABASE_DATABASE' => 'test_db_name',
'DATABASE_USERNAME' => 'test_db_user',
'DATABASE_PASSWORD' => 'test_db_pass',
'DATABASE_HOST' => 'test_db_host',
'DATABASE_PORT' => 'test_db_port',
],
[
'default' => [
'default' => [
'database' => 'test_db_name',
'username' => 'test_db_user',
'password' => 'test_db_pass',
'host' => 'test_db_host',
'port' => 'test_db_port',
'driver' => 'mysql',
'prefix' => '',
],
],
],
],
];
}

Expand Down
2 changes: 1 addition & 1 deletion web/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
[
'default' =>
[
'database' => getenv('DATABASE_NAME') ?: getenv('MARIADB_DATABASE') ?: 'drupal',
'database' => getenv('DATABASE_NAME') ?: getenv('DATABASE_DATABASE') ?: getenv('MARIADB_DATABASE') ?: 'drupal',
'username' => getenv('DATABASE_USERNAME') ?: getenv('MARIADB_USERNAME') ?: 'drupal',
'password' => getenv('DATABASE_PASSWORD') ?: getenv('MARIADB_PASSWORD') ?: 'drupal',
'host' => getenv('DATABASE_HOST') ?: getenv('MARIADB_HOST') ?: 'localhost',
Expand Down

1 comment on commit a4668c7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.