Searches for default config file

main
Yasen Pramatarov 2024-08-01 11:20:31 +03:00
parent 5d240b1dd8
commit 8455a98ec5
1 changed files with 16 additions and 2 deletions

View File

@ -31,8 +31,22 @@ $allowed_urls = [
];
// cnfig file
$config_file = '/home/yasen/work/code/git/lindeas-code/jilo-web/jilo-web.conf.php';
if (file_exists($config_file)) {
// possible locations, in order of preference
$config_file_locations = [
__DIR__ . '/../jilo-web.conf.php',
'/srv/jilo-web/jilo-web.conf.php',
'/opt/jilo-web/jilo-web.conf.php'
];
$config_file = null;
// try to find the config file
foreach ($config_file_locations as $location) {
if (file_exists($location)) {
$config_file = $location;
break;
}
}
// if found, use it
if ($config_file) {
require_once $config_file;
} else {
die('Config file not found');