e949/api/_config.php

25 lines
493 B
PHP
Raw Normal View History

2023-08-19 23:45:47 +05:30
<?php // Parsing configuration file
2023-08-12 04:09:17 +05:30
$Config = array();
$Config_FileName = "config.json";
$Config_PossiblePaths = array(
"./" . $Config_FileName,
"../" . $Config_FileName,
"../../" . $Config_FileName,
"../../../" . $Config_FileName,
"./api/" . $Config_FileName,
);
foreach ($Config_PossiblePaths as $path) {
if (file_exists($path)) {
$content = file_get_contents($path);
$Config = json_decode($content, true);
break;
}
}
if (!$Config) {
die("invalid configuration file");
}
?>