From 0847964a2788c3560ea7a5133508790c2c07adc8 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 14 Jan 2021 09:30:23 +0100 Subject: [PATCH] avoid accessing constants when getting data from env When a setting can be read from the environment variable, avoid accessing the internal defaults. This way the scripts can be accessed directly in \lib as long as the environment is set up correctly with full defaults. --- lib/setup/SetupClass.php | 5 ++++- lib/setup_functions.php | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/setup/SetupClass.php b/lib/setup/SetupClass.php index 92c36bf3..77b14a8a 100755 --- a/lib/setup/SetupClass.php +++ b/lib/setup/SetupClass.php @@ -42,7 +42,10 @@ class SetupFunctions $this->iCacheMemory = getCacheMemoryMB(); } - $this->sModulePath = getSetting('DATABASE_MODULE_PATH', CONST_Default_ModulePath); + $this->sModulePath = getSetting('DATABASE_MODULE_PATH'); + if (!$this->sModulePath) { + $this->sModulePath = CONST_Default_ModulePath; + } info('module path: ' . $this->sModulePath); // parse database string diff --git a/lib/setup_functions.php b/lib/setup_functions.php index dab6a8e7..dc84cf92 100755 --- a/lib/setup_functions.php +++ b/lib/setup_functions.php @@ -17,7 +17,9 @@ function checkInFile($sOSMFile) function getOsm2pgsqlBinary() { - return getSetting('OSM2PGSQL_BINARY', CONST_Default_Osm2pgsql); + $sBinary = getSetting('OSM2PGSQL_BINARY'); + + return $sBinary ? $sBinary : CONST_Default_Osm2pgsql; } function getImportStyle() -- 2.39.5