mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-26 14:53:48 +03:00
Merge pull request #1897 from acelaya-forks/feature/disable-health-endpoint-logs
Do not log requests to the health endpoint
This commit is contained in:
commit
2a782ab60b
7 changed files with 33 additions and 5 deletions
|
@ -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.
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
27
module/Rest/config/access-logs.config.php
Normal file
27
module/Rest/config/access-logs.config.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Rest;
|
||||
|
||||
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
||||
use Laminas\Stdlib\ArrayUtils\MergeReplaceKey;
|
||||
use Shlinkio\Shlink\Common\Middleware\AccessLogMiddleware;
|
||||
|
||||
return [
|
||||
|
||||
'access_logs' => [
|
||||
'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'],
|
||||
),
|
||||
],
|
||||
|
||||
];
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue