diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 8b1adb3..eac177e 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -37,7 +37,7 @@ jobs: file: etc/Dockerfile push: true tags: rtckit/eqivo:${{ github.ref_name }}-full - - run: curl -OL https://downloads.dockerslim.com/releases/1.37.3/dist_linux.tar.gz + - run: curl -OL https://downloads.dockerslim.com/releases/1.37.6/dist_linux.tar.gz - run: tar zfvx dist_linux.tar.gz - run: ./dist_linux/docker-slim build --http-probe-off --continue-after 1 --include-cert-all --include-exe=/usr/local/bin/eqivo --include-exe=/usr/local/bin/php --target rtckit/eqivo:${{ github.ref_name }}-full --tag rtckit/eqivo:${{ github.ref_name }} - run: docker push rtckit/eqivo:${{ github.ref_name }} diff --git a/composer.json b/composer.json index 6c7736f..bba6361 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "rtckit/eqivo", "description": "Telephony API Platform", - "version": "0.5.2", + "version": "0.5.3", "keywords": [ "telecommunications", "voip", @@ -31,7 +31,7 @@ "ext-libxml": "*", "ext-pcre": "*", "ext-simplexml": "*", - "monolog/monolog": "^2.5", + "monolog/monolog": "^3.1", "nikic/fast-route": "^1.3", "ramsey/uuid": "^4.3", "react/event-loop": "^1.3", @@ -40,16 +40,16 @@ "rtckit/esl": "^0.8", "rtckit/react-esl": "^0.8", "rtckit/sip": "^0.7", - "symfony/yaml": "^6.0", - "wikimedia/ip-set": "^3.0", + "symfony/yaml": "^6.1", + "wikimedia/ip-set": "^3.1", "wyrihaximus/react-psr-3-stdio": "^3.0" }, "require-dev": { "clue/block-react": "^1.5", - "phpstan/phpstan": "^1.6", + "phpstan/phpstan": "^1.7", "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^4.22", - "zircote/swagger-php": "^4.3" + "vimeo/psalm": "^4.23", + "zircote/swagger-php": "^4.4" }, "suggest": { "ext-pcntl": "Enables daemonization support", diff --git a/etc/Dockerfile b/etc/Dockerfile index 69ead45..afd4520 100644 --- a/etc/Dockerfile +++ b/etc/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1.5-cli-bullseye +FROM php:8.1.7-cli-bullseye RUN docker-php-ext-install pcntl diff --git a/etc/Dockerfile.dev b/etc/Dockerfile.dev index 96a830d..e1d7a03 100644 --- a/etc/Dockerfile.dev +++ b/etc/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM php:8.1.5-cli-bullseye +FROM php:8.1.7-cli-bullseye RUN docker-php-ext-install pcntl diff --git a/src/App.php b/src/App.php index 87c22ec..55a1850 100644 --- a/src/App.php +++ b/src/App.php @@ -16,7 +16,7 @@ class App { - public const VERSION = '0.8.0'; + public const VERSION = '0.5.3'; public Config\Set $config; diff --git a/src/Config/CliArguments.php b/src/Config/CliArguments.php index 038e0bd..a3ce5ac 100644 --- a/src/Config/CliArguments.php +++ b/src/Config/CliArguments.php @@ -4,7 +4,7 @@ namespace RTCKit\Eqivo\Config; -use Monolog\Logger; +use Monolog\Level; use InvalidArgumentException; class CliArguments implements ResolverInterface @@ -206,7 +206,7 @@ function (string $value): bool { * @psalm-suppress ArgumentTypeCoercion * @phpstan-ignore-next-line */ - $config->restServerLogLevel = Logger::toMonologLevel($args['rest-log-level']); + $config->restServerLogLevel = Level::fromName($args['rest-log-level']); } catch (InvalidArgumentException $e) { fwrite(STDERR, 'Malformed --rest-log-level argument: ' . $e->getMessage() . PHP_EOL); } @@ -278,7 +278,7 @@ function (string $value): bool { * @psalm-suppress ArgumentTypeCoercion * @phpstan-ignore-next-line */ - $config->outboundServerLogLevel = Logger::toMonologLevel($args['outbound-log-level']); + $config->outboundServerLogLevel = Level::fromName($args['outbound-log-level']); } catch (InvalidArgumentException $e) { fwrite(STDERR, 'Malformed --outbound-log-level argument: ' . $e->getMessage() . PHP_EOL); } @@ -291,7 +291,7 @@ function (string $value): bool { * @psalm-suppress ArgumentTypeCoercion * @phpstan-ignore-next-line */ - $config->inboundServerLogLevel = Logger::toMonologLevel($args['inbound-log-level']); + $config->inboundServerLogLevel = Level::fromName($args['inbound-log-level']); } catch (InvalidArgumentException $e) { fwrite(STDERR, 'Malformed --inbound-log-level argument: ' . $e->getMessage() . PHP_EOL); } diff --git a/src/Config/ConfigFile.php b/src/Config/ConfigFile.php index 6b91d95..d802dc5 100644 --- a/src/Config/ConfigFile.php +++ b/src/Config/ConfigFile.php @@ -6,14 +6,11 @@ use RTCKit\Eqivo\Exception\EqivoException; -use Monolog\Logger; +use Monolog\Level; use Symfony\Component\Yaml\Yaml; use Closure; use InvalidArgumentException; -/** - * @phpstan-import-type Level from \Monolog\Logger - */ class ConfigFile implements ResolverInterface { public function resolve(Set $config): void @@ -198,9 +195,12 @@ public function resolve(Set $config): void if (isset($input['restServerLogLevel'])) { try { - /** @var Level */ - $restServerLogLevel = $input['restServerLogLevel']; - $config->restServerLogLevel = Logger::toMonologLevel($restServerLogLevel); + /** + * Allow Monolog to deal with the verbosity level matching + * @psalm-suppress ArgumentTypeCoercion + * @phpstan-ignore-next-line + */ + $config->restServerLogLevel = Level::fromName($input['restServerLogLevel']); } catch (InvalidArgumentException $e) { fwrite(STDERR, 'Malformed `restServerLogLevel` parameter in configuration file: ' . $e->getMessage() . PHP_EOL); } @@ -274,9 +274,12 @@ public function resolve(Set $config): void if (isset($input['outboundServerLogLevel'])) { try { - /** @var Level */ - $outboundServerLogLevel = $input['outboundServerLogLevel']; - $config->outboundServerLogLevel = Logger::toMonologLevel($outboundServerLogLevel); + /** + * Allow Monolog to deal with the verbosity level matching + * @psalm-suppress ArgumentTypeCoercion + * @phpstan-ignore-next-line + */ + $config->outboundServerLogLevel = Level::fromName($input['outboundServerLogLevel']); } catch (InvalidArgumentException $e) { fwrite(STDERR, 'Malformed `outboundServerLogLevel` parameter in configuration file: ' . $e->getMessage() . PHP_EOL); } @@ -284,9 +287,12 @@ public function resolve(Set $config): void if (isset($input['inboundServerLogLevel'])) { try { - /** @var Level */ - $inboundServerLogLevel = $input['inboundServerLogLevel']; - $config->inboundServerLogLevel = Logger::toMonologLevel($inboundServerLogLevel); + /** + * Allow Monolog to deal with the verbosity level matching + * @psalm-suppress ArgumentTypeCoercion + * @phpstan-ignore-next-line + */ + $config->inboundServerLogLevel = Level::fromName($input['inboundServerLogLevel']); } catch (InvalidArgumentException $e) { fwrite(STDERR, 'Malformed `inboundServerLogLevel` parameter in configuration file: ' . $e->getMessage() . PHP_EOL); } diff --git a/src/Config/LegacyConfigFile.php b/src/Config/LegacyConfigFile.php index 6ad08ad..ab37a3b 100644 --- a/src/Config/LegacyConfigFile.php +++ b/src/Config/LegacyConfigFile.php @@ -4,12 +4,9 @@ namespace RTCKit\Eqivo\Config; -use Monolog\Logger; +use Monolog\Level; use InvalidArgumentException; -/** - * @phpstan-import-type Level from \Monolog\Logger - */ class LegacyConfigFile implements ResolverInterface { public function resolve(Set $config): void @@ -150,9 +147,12 @@ function (string $value): bool { if (isset($legacy['rest_server']['LOG_LEVEL'])) { try { - /** @var Level */ - $inboundServerLogLevel = $legacy['rest_server']['LOG_LEVEL']; - $config->inboundServerLogLevel = Logger::toMonologLevel($inboundServerLogLevel); + /** + * Allow Monolog to deal with the verbosity level matching + * @psalm-suppress ArgumentTypeCoercion + * @phpstan-ignore-next-line + */ + $config->restServerLogLevel = $config->inboundServerLogLevel = Level::fromName($legacy['rest_server']['LOG_LEVEL']); } catch (InvalidArgumentException $e) { fwrite(STDERR, 'Malformed LOG_LEVEL (rest_server) line in legacy configuration file' . PHP_EOL); fwrite(STDERR, $e->getMessage() . PHP_EOL); @@ -196,10 +196,12 @@ function (string $value): bool { if (isset($legacy['outbound_server']['LOG_LEVEL'])) { try { - - /** @var Level */ - $outboundServerLogLevel = $legacy['outbound_server']['LOG_LEVEL']; - $config->outboundServerLogLevel = Logger::toMonologLevel($outboundServerLogLevel); + /** + * Allow Monolog to deal with the verbosity level matching + * @psalm-suppress ArgumentTypeCoercion + * @phpstan-ignore-next-line + */ + $config->outboundServerLogLevel = Level::fromName($legacy['outbound_server']['LOG_LEVEL']); } catch (InvalidArgumentException $e) { fwrite(STDERR, 'Malformed LOG_LEVEL (outbound_server) line in legacy configuration file' . PHP_EOL); fwrite(STDERR, $e->getMessage() . PHP_EOL); diff --git a/src/Config/Set.php b/src/Config/Set.php index 8f82fa0..f3f9a02 100644 --- a/src/Config/Set.php +++ b/src/Config/Set.php @@ -4,11 +4,8 @@ namespace RTCKit\Eqivo\Config; -use Monolog\Logger; +use Monolog\Level; -/** - * @phpstan-import-type Level from \Monolog\Logger - */ class Set { public const INBOUND_SOCKET_ADDRESS = 'inbound_socket_address'; @@ -55,8 +52,7 @@ class Set public int $restServerMaxRequestSize = 16384; - /** @phpstan-var Level */ - public int $restServerLogLevel = Logger::DEBUG; + public Level $restServerLogLevel = Level::Debug; /** @var list Allowed CIDRs */ public array $restAllowedIps = []; @@ -76,12 +72,10 @@ class Set public int $outboundServerAdvertisedPort; - /** @phpstan-var Level */ - public int $outboundServerLogLevel = Logger::DEBUG; + public Level $outboundServerLogLevel = Level::Debug; /* Inbound Server settings */ - /** @phpstan-var Level */ - public int $inboundServerLogLevel = Logger::DEBUG; + public Level $inboundServerLogLevel = Level::Debug; public string $callHeartbeatUrl;