Basis for support for gemserv config type

This commit is contained in:
Romain de Laage 2021-05-25 14:53:55 +02:00
parent 5fde879096
commit 77469eec59
Signed by: rdelaage
GPG Key ID: 534845FADDF0C329
1 changed files with 15 additions and 7 deletions

View File

@ -42,17 +42,25 @@ if(isset($_GET['q']))
else
$q = $_SERVER['REQUEST_URI'];
// Loading config...
$conf_filename = @realpath(ERGOL_JSON);
$conf_filename = @realpath(CONFIG_PATH);
$conf_json = file_get_contents($conf_filename);
if($conf_json===false)
$conf_content = file_get_contents($conf_filename);
if($conf_content===false)
die("Unable to open file ".$conf_filename."\n");
$conf_json = preg_replace('/[\x00-\x1F\x80-\xFF]/', '',$conf_json);
if(CONFIG_TYPE === "ergol") {
$conf_content = preg_replace('/[\x00-\x1F\x80-\xFF]/', '',$conf_content);
$conf = json_decode($conf_json);
if($conf===null)
die("Unable to parse ".$conf_filename." : ".json_last_error_msg()."\n");
$conf = json_decode($conf_content);
if($conf===null)
die("Unable to parse ".$conf_filename." : ".json_last_error_msg()."\n");
}
else if(CONFIG_TYPE === "gemserv") {
//here script for gemserv config type
}
else {
die("Unknown config type: ".CONFIG_TYPE."\n");
}
foreach($conf->capsules as $hostname => $capsule)
{