diff --git a/cmake/script.tmpl b/cmake/script.tmpl index 1b0cab64..4d9224b0 100755 --- a/cmake/script.tmpl +++ b/cmake/script.tmpl @@ -3,7 +3,5 @@ @define('CONST_BinDir', '@CMAKE_SOURCE_DIR@/utils'); @define('CONST_LibDir', '@CMAKE_SOURCE_DIR@/lib'); @define('CONST_DataDir', '@CMAKE_SOURCE_DIR@'); -@define('CONST_InstallDir', '@CMAKE_BINARY_DIR@'); -require_once(CONST_InstallDir.'/settings/settings.php'); require_once(CONST_BinDir.'/@script_source@'); diff --git a/lib/lib.php b/lib/lib.php index fcd22066..9861cdd0 100644 --- a/lib/lib.php +++ b/lib/lib.php @@ -1,5 +1,23 @@ load($sProjectDir.'/.env'); + } + $dotenv->load(CONST_DataDir.'/settings/env.defaults'); +} + function fail($sError, $sUserError = false) { if (!$sUserError) $sUserError = $sError; diff --git a/utils/setup.php b/utils/setup.php index 95ad7992..10d7e155 100644 --- a/utils/setup.php +++ b/utils/setup.php @@ -44,11 +44,13 @@ $aCMDOptions array('create-country-names', '', 0, 1, 0, 0, 'bool', 'Create default list of searchable country names'), array('drop', '', 0, 1, 0, 0, 'bool', 'Drop tables needed for updates, making the database readonly (EXPERIMENTAL)'), array('setup-website', '', 0, 1, 0, 0, 'bool', 'Used to compile environment variables for the website'), + array('project-dir', '', 0, 1, 1, 1, 'realpath', 'Base directory for this Nominatim installation'), ); // $aCMDOptions passed to getCmdOpt by reference getCmdOpt($_SERVER['argv'], $aCMDOptions, $aCMDResult, true, true); +loadSettings($aCMDResult['project-dir'] ?? false); setupHTTPProxy(); $bDidSomething = false;