diff --git a/app/application/app/Helpers/Helpers.php b/app/application/app/Helpers/Helpers.php index fb25426..3708dc9 100644 --- a/app/application/app/Helpers/Helpers.php +++ b/app/application/app/Helpers/Helpers.php @@ -38,4 +38,9 @@ public static function shortDigest(string $digest): string $digest = Str::of($digest)->explode(':', 2)->last(); return Str::of($digest)->take(12)->toString(); } + + public static function dockerServiceAddress(): string + { + return Str::of(config('registry.service_http'))->remove(['http://', 'https://'])->toString(); + } } diff --git a/app/application/app/Services/Site/AccessTokenService.php b/app/application/app/Services/Site/AccessTokenService.php index c901b2d..8d4c059 100644 --- a/app/application/app/Services/Site/AccessTokenService.php +++ b/app/application/app/Services/Site/AccessTokenService.php @@ -5,6 +5,7 @@ use App\Dto\QuerySettingsDto; use App\Dto\Service\Site\AccessTokens\StoreUpdate; use App\Enums\AccessTokenPermission; +use App\Helpers\Helpers; use App\Models\User; use App\Repositories\AccessTokenRepository; use App\ServiceResults\ServiceResultArray; @@ -39,7 +40,7 @@ public function create(User $user): ServiceResultError | ServiceResultArray { return $this->result([ 'user' => $user, - 'serviceAddress' => config('registry.service_http'), + 'serviceAddress' => Helpers::dockerServiceAddress(), 'permissions' => AccessTokenPermission::toCollection()->pluck('title', 'value')->toArray(), ]); } diff --git a/app/application/app/Services/Site/RepositoryService.php b/app/application/app/Services/Site/RepositoryService.php index 0132af0..03c087a 100644 --- a/app/application/app/Services/Site/RepositoryService.php +++ b/app/application/app/Services/Site/RepositoryService.php @@ -5,6 +5,7 @@ use App\Dto\Builder\Repository as RepositoryBuilder; use App\Dto\QuerySettingsDto; use App\Dto\Service\Site\Repository\StoreUpdate; +use App\Helpers\Helpers; use App\Models\Repository; use App\Models\User; use App\Repositories\RepositoryRepository; @@ -65,7 +66,7 @@ public function repository(string $username, string $repositoryName, ?User $user return $this->result([ 'repository' => $repository, 'pageUser' => $pageUser, - 'serviceAddress' => config('registry.service_http'), + 'serviceAddress' => Helpers::dockerServiceAddress(), ]); } diff --git a/app/application/app/Services/Site/TagRepositoryService.php b/app/application/app/Services/Site/TagRepositoryService.php index 228a799..c100f73 100644 --- a/app/application/app/Services/Site/TagRepositoryService.php +++ b/app/application/app/Services/Site/TagRepositoryService.php @@ -3,6 +3,7 @@ namespace App\Services\Site; use App\Dto\QuerySettingsDto; +use App\Helpers\Helpers; use App\Models\User; use App\Repositories\RepositoryRepository; use App\Repositories\TagRepositoryRepository; @@ -55,7 +56,7 @@ public function tags(string $username, string $repositoryName, QuerySettingsDto 'tags' => $tags, 'repository' => $repository, 'pageUser' => $pageUser, - 'serviceAddress' => config('registry.service_http'), + 'serviceAddress' => Helpers::dockerServiceAddress(), ]); }