Implemented interaction with docker registry.
This commit is contained in:
@@ -4,6 +4,7 @@ use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Configuration\Exceptions;
|
||||
use Illuminate\Foundation\Configuration\Middleware;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
return Application::configure(basePath: dirname(__DIR__))
|
||||
->withRouting(
|
||||
@@ -16,11 +17,38 @@ return Application::configure(basePath: dirname(__DIR__))
|
||||
->prefix('admin')
|
||||
->as('admin.')
|
||||
->group(base_path('routes/admin.php'));
|
||||
|
||||
Route::middleware(['api'])
|
||||
->prefix('registry')
|
||||
->name('registry.')
|
||||
->group(base_path('routes/registry.php'));
|
||||
},
|
||||
)
|
||||
->withMiddleware(function (Middleware $middleware) {
|
||||
//
|
||||
$middleware->validateCsrfTokens(except: [
|
||||
'/registry/v2/event',
|
||||
'/registry/v2/event/*',
|
||||
]);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions) {
|
||||
//
|
||||
|
||||
$exceptions->renderable(function (\Illuminate\Auth\AuthenticationException $e, Request $request) {
|
||||
if ($request->is('registry/*')) {
|
||||
return \response()->json([
|
||||
'message' => $e->getMessage(),
|
||||
], \Illuminate\Http\Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
$exceptions->renderable(function (\Illuminate\Http\Exceptions\HttpResponseException $e, Request $request) {
|
||||
if ($request->is('registry/*')) {
|
||||
return \response()->json([
|
||||
'message' => $e->getResponse()->getContent(),
|
||||
], $e->getResponse()->getStatusCode());
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
})->create();
|
||||
|
Reference in New Issue
Block a user