On config errors do not exit but throw exception

This commit is contained in:
Clemens Schwaighofer
2025-01-29 09:57:58 +09:00
parent b493b3c4fd
commit 2c234ccef6

View File

@@ -183,8 +183,9 @@ if (file_exists(BASE . CONFIGS . 'config.path.php')) {
define('HOST_NAME', $HOST_NAME);
// BAIL ON MISSING MASTER SITE CONFIG
if (!isset($SITE_CONFIG[HOST_NAME]['location'])) {
echo 'Missing SITE_CONFIG entry for: "' . HOST_NAME . '". Contact Administrator';
exit(1);
throw new \InvalidArgumentException(
'Missing SITE_CONFIG entry for: "' . HOST_NAME . '". Contact Administrator'
);
}
// BAIL ON MISSING DB CONFIG:
// we have either no db selction for this host but have db config entries
@@ -200,8 +201,9 @@ if (
empty($DB_CONFIG[$SITE_CONFIG[HOST_NAME]['db_host']]))
)
) {
echo 'No matching DB config found for: "' . HOST_NAME . '". Contact Administrator';
exit(1);
throw new \InvalidArgumentException(
'No matching DB config found for: "' . HOST_NAME . '". Contact Administrator'
);
}
// set SSL on
$is_secure = false;