Files
mdhub/app/application/app/Providers/RegistryServiceProvider.php

46 lines
1.4 KiB
PHP

<?php declare(strict_types=1);
namespace App\Providers;
use App\Contracts\Services\Registry\Base32;
use App\Dto\Service\Registry\V2\AuthorizationConfig;
use App\Services\Registry\V2\Api\RequestCommandHandler;
use App\Services\Registry\V2\Base32CommandHandler;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\ServiceProvider;
final class RegistryServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
$this->app->bind(Base32::class, Base32CommandHandler::class);
$this->app->bind(AuthorizationConfig::class, function () {
return new AuthorizationConfig(
serviceName: \config('registry.service_name' , ''),
privateKeyName: \config('registry.private_key_name' , ''),
issuer: \config('registry.issuer' , ''),
algorithm: \config('registry.algorithm' , 'RS256'),
expiresInSeconds: (int) \config('registry.expires_in_seconds' , 600),
);
});
$this->app->bind(RequestCommandHandler::class, function (Application $app) {
return new RequestCommandHandler(
baseUrl: \config('registry.service_http') . '/v2'
);
});
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
}
}