fix config handling

This commit is contained in:
Dennis Eichhorn 2022-11-04 22:54:28 +01:00
parent 4cfc1820cd
commit aa60c34188
3 changed files with 8 additions and 2 deletions

View File

@ -60,6 +60,8 @@ int main(int argc, char **argv)
// Load config
FILE *in = fopen("config.json", "r");
if (in == NULL) {
printf("Couldn't open config.json\n");
return -1;
}

View File

@ -107,8 +107,12 @@ abstract class InstallAbstract extends ApplicationAbstract
$defaultAppLower = \strtolower($defaultApp);
$config = include __DIR__ . '/Templates/config.tpl.php';
\file_put_contents(__DIR__ . '/../config.php', $config);
$configJson = include __DIR__ . '/Templates/config.tpl.php';
\file_put_contents(__DIR__ . '/../config.json', \json_decode($configJson, \JSON_PRETTY_PRINT));
\unlink(__DIR__ . '/../config.php');
}
protected static function editHtaccessFile(RequestAbstract $request): void

View File

@ -5,7 +5,7 @@ declare(strict_types=1);
require_once __DIR__ . '/phpOMS/Autoloader.php';
$config = require_once __DIR__ . '/config.php';
$config = \json_decode(\file_get_contents(__DIR__ . '/config.json'), true);
$App = new \WebApplication($config);