Refactoring, logging improvements
This commit is contained in:
@ -9,14 +9,14 @@ file_exists(__DIR__."/../../../autoload.php") && require_once __DIR__."/../../..
|
||||
|
||||
if (file_exists(__DIR__."/../src/meta")) {
|
||||
$meta = require_once(__DIR__."/../src/meta");
|
||||
define("MERCUREACT_VERSION", $meta['version']??'0.0.0');
|
||||
define("MERCUREACT_VERSION", $meta['version']?:'0.0.0');
|
||||
define("MERCUREACT_BUILDTIME", $meta['buildtime']);
|
||||
} else {
|
||||
define("MERCUREACT_VERSION", "DEV");
|
||||
define("MERCUREACT_BUILDTIME", null);
|
||||
}
|
||||
|
||||
$opts = getopt("c:C:h");
|
||||
$opts = getopt("c:C:hvV");
|
||||
|
||||
if (isset($opts['h'])) {
|
||||
$info = "v".MERCUREACT_VERSION.(MERCUREACT_BUILDTIME?("\nBuilt on ".MERCUREACT_BUILDTIME):"");
|
||||
@ -26,6 +26,8 @@ if (isset($opts['h'])) {
|
||||
|
||||
Options:
|
||||
|
||||
-V Print version and exit
|
||||
-v Verbose debug logging
|
||||
-c config Read configuration from file
|
||||
-C config Write a new configuration to file and open with editor
|
||||
|
||||
@ -34,6 +36,11 @@ if (isset($opts['h'])) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (isset($opts['V'])) {
|
||||
fprintf(STDOUT, "Mercureact %s\nBuilt on %s\n", MERCUREACT_VERSION, MERCUREACT_BUILDTIME);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (isset($opts['C'])) {
|
||||
$file = $opts['C'];
|
||||
if (file_exists($file)) {
|
||||
@ -78,5 +85,7 @@ if (isset($opts['c'])) {
|
||||
->setJwtSecret("!ChangeThisMercureHubJWTSecretKey!");
|
||||
}
|
||||
|
||||
$daemon = new Daemon($config);
|
||||
$verbose = isset($opts['v']);
|
||||
|
||||
$daemon = new Daemon($config, $verbose);
|
||||
$daemon->start();
|
||||
|
Reference in New Issue
Block a user