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
|
<?php
|
||||||
|
|
||||||
$aConfig = array(
|
$aConfig = array(
|
||||||
"user" => 'legacyworlds',
|
'host' => '127.0.0.1',
|
||||||
"password" => 'password for the standard database user',
|
'database' => 'legacyworlds',
|
||||||
"adminUser" => 'legacyworlds_admin',
|
'user' => 'legacyworlds',
|
||||||
"adminPassword" => 'password for the administrative database user',
|
'password' => 'password for the standard database user',
|
||||||
"ctrlFifo" =>'/tmp/.lwFifo',
|
'adminUser' => 'legacyworlds_admin',
|
||||||
"ctrlPath" =>'/tmp/.lwControl'
|
'adminPassword' => 'password for the administrative database user',
|
||||||
|
'ctrlFifo' =>'/tmp/.lwFifo',
|
||||||
|
'ctrlPath' =>'/tmp/.lwControl'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
function __dbConnect($admin = false) {
|
function __dbConnect($admin = false) {
|
||||||
global $aConfig;
|
global $aConfig;
|
||||||
|
$h = $aConfig['host'];
|
||||||
|
$d = $aConfig['database'];
|
||||||
$u = $aConfig[$admin ? 'adminUser' : 'user'];
|
$u = $aConfig[$admin ? 'adminUser' : 'user'];
|
||||||
$p = $aConfig[$admin ? 'adminPassword' : 'password'];
|
$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);
|
return pg_connect($cString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue