feat: add hostname/db name config for the admin interface
This commit is contained in:
parent
9e12cf9036
commit
c91440af72
1 changed files with 11 additions and 7 deletions
|
@ -1,20 +1,24 @@
|
|||
<?php
|
||||
|
||||
$aConfig = array(
|
||||
"user" => 'legacyworlds',
|
||||
"password" => 'password for the standard database user',
|
||||
"adminUser" => 'legacyworlds_admin',
|
||||
"adminPassword" => 'password for the administrative database user',
|
||||
"ctrlFifo" =>'/tmp/.lwFifo',
|
||||
"ctrlPath" =>'/tmp/.lwControl'
|
||||
'host' => '127.0.0.1',
|
||||
'database' => 'legacyworlds',
|
||||
'user' => 'legacyworlds',
|
||||
'password' => 'password for the standard database user',
|
||||
'adminUser' => 'legacyworlds_admin',
|
||||
'adminPassword' => 'password for the administrative database user',
|
||||
'ctrlFifo' =>'/tmp/.lwFifo',
|
||||
'ctrlPath' =>'/tmp/.lwControl'
|
||||
);
|
||||
|
||||
|
||||
function __dbConnect($admin = false) {
|
||||
global $aConfig;
|
||||
$h = $aConfig['host'];
|
||||
$d = $aConfig['database'];
|
||||
$u = $aConfig[$admin ? 'adminUser' : 'user'];
|
||||
$p = $aConfig[$admin ? 'adminPassword' : 'password'];
|
||||
$cString = "dbname='legacyworlds' host='127.0.0.1' sslmode='prefer' user='$u' password='$p'";
|
||||
$cString = "dbname='$d' host='$h' sslmode='prefer' user='$u' password='$p'";
|
||||
return pg_connect($cString);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue