feat: custom RDAP servers

This commit is contained in:
Maël Gangloff
2024-08-19 18:06:11 +02:00
parent b473a6932a
commit 0b0d4257da
4 changed files with 48 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ namespace App\MessageHandler;
use App\Message\UpdateRdapServers;
use App\Service\RDAPService;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Messenger\Attribute\AsMessageHandler;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
@@ -14,8 +15,10 @@ use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
#[AsMessageHandler]
final readonly class UpdateRdapServersHandler
{
public function __construct(private RDAPService $RDAPService)
{
public function __construct(
private RDAPService $RDAPService,
private ParameterBagInterface $bag
) {
}
/**
@@ -29,17 +32,32 @@ final readonly class UpdateRdapServersHandler
{
/** @var \Throwable[] $throws */
$throws = [];
try {
$this->RDAPService->updateTldListIANA();
$this->RDAPService->updateGTldListICANN();
} catch (\Throwable $throwable) {
$throws[] = $throwable;
}
try {
$this->RDAPService->updateRDAPServers();
$this->RDAPService->updateRDAPServersFromIANA();
} catch (\Throwable $throwable) {
$throws[] = $throwable;
}
try {
$this->RDAPService->updateRDAPServersFromIANA();
} catch (\Throwable $throwable) {
$throws[] = $throwable;
}
try {
$this->RDAPService->updateRDAPServersFromFile($this->bag->get('custom_rdap_servers_file'));
} catch (\Throwable $throwable) {
$throws[] = $throwable;
}
if (!empty($throws)) {
throw $throws[0];
}