Remove redundant variables

This commit is contained in:
Manuel Thalmann 2019-10-07 02:45:55 +00:00
parent 7718b1dad7
commit bdb2e4e02f
2 changed files with 20 additions and 6 deletions

View file

@ -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

View file

@ -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();