diff --git a/app/server/main.cpp b/app/server/main.cpp index 2bb6e09..0000970 100755 --- a/app/server/main.cpp +++ b/app/server/main.cpp @@ -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; } diff --git a/app/web/Install/InstallAbstract.php b/app/web/Install/InstallAbstract.php index 2ee33a2..fc2be4d 100755 --- a/app/web/Install/InstallAbstract.php +++ b/app/web/Install/InstallAbstract.php @@ -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 diff --git a/app/web/index.php b/app/web/index.php index 77ba164..45ca1cf 100755 --- a/app/web/index.php +++ b/app/web/index.php @@ -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);