Skip to content

Commit

Permalink
allow db connection segments to be set as environment variables (#1873)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phanoix authored Jul 5, 2018
1 parent fce239c commit aa7af7d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions install/cli/docker_installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@
else
$dbhost = 'gcconnex-db';

if (getenv('DBUSER') != '')
$dbuser = getenv('DBUSER');
else
$dbuser = 'elgg';

if (getenv('DBPASS') != '')
$dbpass = getenv('DBPASS');
else
$dbpass = 'gcconnex';

if (getenv('DBNAME') != '')
$dbname = getenv('DBNAME');
else
$dbname = 'elgg';


if (getenv('WWWROOT') != '')
$wwwroot = getenv('WWWROOT');
else
Expand All @@ -36,9 +52,9 @@
// none of the following may be empty
$params = array(
// database parameters
'dbuser' => 'elgg',
'dbpassword' => 'gcconnex',
'dbname' => 'elgg',
'dbuser' => $dbuser,
'dbpassword' => $dbpass,
'dbname' => $dbname,

// We use a wonky dbprefix to catch any cases where folks hardcode "elgg_"
// instead of using config->dbprefix
Expand Down

0 comments on commit aa7af7d

Please sign in to comment.