From: Tim Düsterhus Date: Fri, 7 Aug 2015 23:30:24 +0000 (+0200) Subject: Allow to pass database credentials via env in WCFSetup X-Git-Tag: 3.0.0_Beta_1~2139^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c1eb067d9abd821594430a448398d53ae87356ef;p=GitHub%2FWoltLab%2FWCF.git Allow to pass database credentials via env in WCFSetup --- diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index cecd532ed9..598850a8b7 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -571,19 +571,29 @@ class WCFSetup extends WCF { */ protected function configureDB() { $availableDBClasses = self::getAvailableDBClasses(); - $dbHost = 'localhost'; - $dbUser = 'root'; - $dbPassword = ''; - $dbName = 'wcf'; - $dbNumber = 1; - $dbClass = ''; + if (self::$developerMode && isset($_ENV['WCFSETUP_DBHOST'])) { + $dbHost = $_ENV['WCFSETUP_DBHOST']; + $dbUser = $_ENV['WCFSETUP_DBUSER']; + $dbPassword = $_ENV['WCFSETUP_DBPASSWORD']; + $dbName = $_ENV['WCFSETUP_DBNAME']; + $dbNumber = 1; + } + else { + $dbHost = 'localhost'; + $dbUser = 'root'; + $dbPassword = ''; + $dbName = 'wcf'; + $dbNumber = 1; + $dbClass = ''; + } + // set $dbClass to first item in $availableDBClasses foreach ($availableDBClasses as $dbClass) { $dbClass = $dbClass['class']; break; } - if (isset($_POST['send'])) { + if (isset($_POST['send']) || (self::$developerMode && isset($_ENV['WCFSETUP_DBHOST']))) { if (isset($_POST['dbHost'])) $dbHost = $_POST['dbHost']; if (isset($_POST['dbUser'])) $dbUser = $_POST['dbUser']; if (isset($_POST['dbPassword'])) $dbPassword = $_POST['dbPassword'];