diff --git a/CHANGELOG.md b/CHANGELOG.md index 26e141e0..67e8a6b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this * [#1835](https://github.com/shlinkio/shlink/issues/1835) Docker image is now built only when a release is tagged, and new tags are included, for minor and major versions. * [#1055](https://github.com/shlinkio/shlink/issues/1055) Update OAS definition to v3.1. * [#1885](https://github.com/shlinkio/shlink/issues/1885) Update to chronos 3.0. +* [#1896](https://github.com/shlinkio/shlink/issues/1896) Requests to health endpoint are no longer logged. ### Deprecated * [#1783](https://github.com/shlinkio/shlink/issues/1783) Deprecated support for openswoole. RoadRunner is the best replacement, with the same capabilities, but much easier and convenient to install and manage. diff --git a/composer.json b/composer.json index 4f8ca4df..34168f62 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ "php-middleware/request-id": "^4.1", "pugx/shortid-php": "^1.1", "ramsey/uuid": "^4.7", - "shlinkio/shlink-common": "dev-main#8253378 as 5.7", + "shlinkio/shlink-common": "dev-main#4e859a7 as 5.7", "shlinkio/shlink-config": "dev-main#c0aa01f as 2.5", "shlinkio/shlink-event-dispatcher": "dev-main#bd3a62b as 3.1", "shlinkio/shlink-importer": "^5.1", diff --git a/module/Core/config/dependencies.config.php b/module/Core/config/dependencies.config.php index da653406..a245b10e 100644 --- a/module/Core/config/dependencies.config.php +++ b/module/Core/config/dependencies.config.php @@ -9,7 +9,6 @@ use Laminas\ServiceManager\Factory\InvokableFactory; use Psr\EventDispatcher\EventDispatcherInterface; use Shlinkio\Shlink\Common\Doctrine\EntityRepositoryFactory; use Shlinkio\Shlink\Config\Factory\ValinorConfigFactory; -use Shlinkio\Shlink\Core\ErrorHandler; use Shlinkio\Shlink\Core\Options\NotFoundRedirectOptions; use Shlinkio\Shlink\Importer\ImportedLinksProcessorInterface; use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface; diff --git a/module/Core/src/Model/DeviceType.php b/module/Core/src/Model/DeviceType.php index e394716a..3b6d9fcc 100644 --- a/module/Core/src/Model/DeviceType.php +++ b/module/Core/src/Model/DeviceType.php @@ -12,7 +12,7 @@ enum DeviceType: string public static function matchFromUserAgent(string $userAgent): ?self { - $detect = new MobileDetect(userAgent: $userAgent); // @phpstan-ignore-line + $detect = new MobileDetect(userAgent: $userAgent); return match (true) { // $detect->is('iOS') && $detect->isTablet() => self::IOS, // TODO To detect iPad only diff --git a/module/Rest/config/access-logs.config.php b/module/Rest/config/access-logs.config.php new file mode 100644 index 00000000..1f0dd0e8 --- /dev/null +++ b/module/Rest/config/access-logs.config.php @@ -0,0 +1,27 @@ + [ + 'ignored_paths' => [ + Action\HealthAction::ROUTE_PATH, + ], + ], + + // This config needs to go in this file in order to override the value defined in shlink-common + ConfigAbstractFactory::class => [ + // Use MergeReplaceKey to overwrite what was defined in shlink-common, instead of merging it + AccessLogMiddleware::class => new MergeReplaceKey( + [AccessLogMiddleware::LOGGER_SERVICE_NAME, 'config.access_logs.ignored_paths'], + ), + ], + +]; diff --git a/module/Rest/src/Action/HealthAction.php b/module/Rest/src/Action/HealthAction.php index f3bfea98..809bf4d1 100644 --- a/module/Rest/src/Action/HealthAction.php +++ b/module/Rest/src/Action/HealthAction.php @@ -17,7 +17,7 @@ class HealthAction extends AbstractRestAction private const STATUS_PASS = 'pass'; private const STATUS_FAIL = 'fail'; - protected const ROUTE_PATH = '/health'; + public const ROUTE_PATH = '/health'; protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET]; public function __construct(private EntityManagerInterface $em, private AppOptions $options) diff --git a/module/Rest/test/ConfigProviderTest.php b/module/Rest/test/ConfigProviderTest.php index 72063a72..305654b3 100644 --- a/module/Rest/test/ConfigProviderTest.php +++ b/module/Rest/test/ConfigProviderTest.php @@ -24,10 +24,11 @@ class ConfigProviderTest extends TestCase { $config = ($this->configProvider)(); - self::assertCount(4, $config); + self::assertCount(5, $config); self::assertArrayHasKey('dependencies', $config); self::assertArrayHasKey('auth', $config); self::assertArrayHasKey('entity_manager', $config); + self::assertArrayHasKey('access_logs', $config); self::assertArrayHasKey(ConfigAbstractFactory::class, $config); }