Files
ntfi/bin/ntfid
Christopher Vagnetoft c05cc0c23a Show built version in phar
2026-01-17 18:09:31 +01:00

36 lines
843 B
PHP
Executable File

#!/usr/bin/env php
<?php
use Psr\Log\AbstractLogger;
require_once __DIR__."/../vendor/autoload.php";
$opts = getopt("hc:",["help","config:"],$optind);
$configFile = isset($opts['c'])
? $opts['c']
: (isset($opts['config'])
? $opts['config']
: null);
$logger = new class extends AbstractLogger
{
public function log($level, string|Stringable $message, array $context = []): void
{
printf("[%s] %s %s\n", $level, $message, $context?json_encode($context,JSON_UNESCAPED_SLASHES):'');
}
};
if (file_exists(__DIR__."/../src/build.php")) {
$build = include(__DIR__."/../src/build.php");
define("APP_VERSION", $build['version']);
} else {
define("APP_VERSION", "Dev");
}
$daemon = (new NoccyLabs\Ntfi\NtfiDaemon())
->setLogger($logger)
->setConfigFile($configFile)
->start();