mercureact/bin/mercureactd

31 lines
722 B
Plaintext
Raw Normal View History

2024-03-10 02:06:19 +00:00
#!/usr/bin/env php
<?php
use NoccyLabs\Mercureact\Configuration;
use NoccyLabs\Mercureact\Daemon;
require_once __DIR__."/../vendor/autoload.php";
2024-03-11 01:15:04 +00:00
$opts = getopt("c:");
if (isset($opts['c'])) {
$config = Configuration::fromFile($opts['c']);
} else {
$config = Configuration::createDefault()
->addListener([
'address' => '127.0.0.1:8888',
'subscribe' => [
'anonymous' => true
]
])
2024-03-11 01:15:04 +00:00
->setAllowAnonymousSubscribe(true)
->setJwtSecret("!ChangeThisMercureHubJWTSecretKey!");
}
2024-03-10 02:06:19 +00:00
if (count($config->getListeners()) == 0) {
fwrite(STDERR, "No listeners available\n");
exit(1);
}
2024-03-10 02:06:19 +00:00
$daemon = new Daemon($config);
$daemon->start();