Initial config file parsing logic

This commit is contained in:
2024-03-11 02:15:04 +01:00
parent d310060309
commit 0714db3f29
7 changed files with 307 additions and 6 deletions

View File

@ -6,9 +6,15 @@ use NoccyLabs\Mercureact\Daemon;
require_once __DIR__."/../vendor/autoload.php";
$config = Configuration::createDefault()
->setAllowAnonymousSubscribe(true)
->setJwtSecret("!ChangeThisMercureHubJWTSecretKey!");
$opts = getopt("c:");
if (isset($opts['c'])) {
$config = Configuration::fromFile($opts['c']);
} else {
$config = Configuration::createDefault()
->setAllowAnonymousSubscribe(true)
->setJwtSecret("!ChangeThisMercureHubJWTSecretKey!");
}
$daemon = new Daemon($config);
$daemon->start();