replace database settings with dotenv variant

As we can't refer to the project root dir in the module path, the
module path may now also be a relative directory which is then
taken as being relative to the project root path.

Moves the checkModulePresence() function into the Setup class, so
that it can work on the computed absolute module path.
This commit is contained in:
Sarah Hoffmann
2020-12-15 15:12:28 +01:00
parent 25bdd7c6d9
commit 15a1666f8a
10 changed files with 170 additions and 39 deletions

View File

@@ -35,7 +35,7 @@ if ($oDB->checkConnection()) {
echo <<< END
Hints:
* Is the database server started?
* Check the CONST_Database_DSN variable in build/settings/local.php
* Check the NOMINATIM_DATABASE_DSN variable in your local .env
* Try connecting to the database with the same settings
END;

View File

@@ -147,7 +147,7 @@ if ($aCMDResult['wiki-import']) {
. ";\n",
pg_escape_string($aPair[0]),
pg_escape_string($aPair[1]),
CONST_Database_Web_User
getSetting('DATABASE_WEBUSER');
);
}

View File

@@ -57,7 +57,7 @@ $oDB = new Nominatim\DB();
$oDB->connect();
$fPostgresVersion = $oDB->getPostgresVersion();
$aDSNInfo = Nominatim\DB::parseDSN(CONST_Database_DSN);
$aDSNInfo = Nominatim\DB::parseDSN(getSetting('DATABASE_DSN'));
if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
// cache memory to be used by osm2pgsql, should not be more than the available memory