From bdb2e4e02f8d138023c9107f457dffc9ef6230cd Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Mon, 7 Oct 2019 02:45:55 +0000 Subject: [PATCH] Remove redundant variables --- .devcontainer/.env | 10 ++++------ test/website/public/index.php | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.devcontainer/.env b/.devcontainer/.env index 2defcf8..6dd71e7 100644 --- a/.devcontainer/.env +++ b/.devcontainer/.env @@ -1,13 +1,11 @@ +MYSQL_DATABASE=SilverStripe +MYSQL_ROOT_PASSWORD=root + SS_ENVIRONMENT_TYPE=dev -SS_BASE_URL=http://localhost +SS_BASE_URL=http://localhost:8080 SS_DATABASE_CLASS=MySQLPDODatabase SS_DATABASE_SERVER=db -MYSQL_DATABASE=SilverStripe -SS_DATABASE_NAME=SilverStripe -SS_DATABASE_USERNAME=root -MYSQL_ROOT_PASSWORD=root -SS_DATABASE_PASSWORD=root SS_DEFAULT_ADMIN_USERNAME=admin SS_DEFAULT_ADMIN_PASSWORD=admin \ No newline at end of file diff --git a/test/website/public/index.php b/test/website/public/index.php index 5ee1af1..9516aaf 100644 --- a/test/website/public/index.php +++ b/test/website/public/index.php @@ -3,6 +3,7 @@ use SilverStripe\Control\HTTPApplication; use SilverStripe\Control\HTTPRequestBuilder; use SilverStripe\Core\CoreKernel; +use SilverStripe\Core\Environment; // Find autoload.php if (file_exists(__DIR__ . '/../vendor/autoload.php')) { @@ -15,6 +16,21 @@ if (file_exists(__DIR__ . '/../vendor/autoload.php')) { exit(1); } +if (Environment::getEnv("SS_DATABASE_USERNAME") === false) +{ + Environment::setEnv("SS_DATABASE_USERNAME", Environment::getEnv("MYSQL_USERNAME") ?: "root"); +} + +if (Environment::getEnv("SS_DATABASE_PASSWORD") === false) +{ + Environment::setEnv("SS_DATABASE_PASSWORD", Environment::getEnv("MYSQL_PASSWORD") ?: Environment::getEnv("MYSQL_ROOT_PASSWORD")); +} + +if (Environment::getEnv("SS_DATABASE_NAME") === false) +{ + Environment::setEnv("SS_DATABASE_NAME", Environment::getEnv("MYSQL_DATABASE")); +} + // Build request and detect flush $request = HTTPRequestBuilder::createFromEnvironment();