]> git.openstreetmap.org Git - nominatim.git/commitdiff
avoid accessing constants when getting data from env
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 14 Jan 2021 08:30:23 +0000 (09:30 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 14 Jan 2021 08:37:04 +0000 (09:37 +0100)
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
lib/setup_functions.php

index 92c36bf3ab306e680a972dc2a2e934264b968285..77b14a8a4c27260a3a5bde6c303a43f86b16af83 100755 (executable)
@@ -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
index dab6a8e73e399f09d8682085f15ea2335f6bb7f6..dc84cf92852df0a98765cad45f2adfd39d261571 100755 (executable)
@@ -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()