2021-03-01 16:01:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Picea\Picea;
|
|
|
|
|
|
|
|
use CSLSJ\Debogueur\DebogueurMiddleware;
|
|
|
|
|
|
|
|
use Laminas\Diactoros\Response\HtmlResponse;
|
|
|
|
|
|
|
|
use Psr\Http\Server\MiddlewareInterface,
|
|
|
|
Psr\Http\Message\ServerRequestInterface,
|
|
|
|
Psr\Http\Server\RequestHandlerInterface,
|
|
|
|
Psr\Http\Message\ResponseInterface;
|
|
|
|
|
|
|
|
use function DI\{ create, get, autowire };
|
|
|
|
|
|
|
|
error_reporting(getenv('ERROR_REPORTING') ?: ( E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE ));
|
|
|
|
|
|
|
|
return [
|
|
|
|
/* do nothing in production !*/
|
|
|
|
"dump" => function($c) {
|
|
|
|
if (! function_exists('dump') ) {
|
|
|
|
function dump(...$what) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
return new class implements MiddlewareInterface {
|
|
|
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface { return $handler->handle($request); }
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
"errorHandler" => create(DebogueurMiddleware::class)->constructor(getenv('DEBOGUEUR_HASH') ?: "", null, get('app.errorhandler.html')),
|
|
|
|
|
|
|
|
'app.errorhandler.html' => function($c, Picea $picea) {
|
|
|
|
return function(\Throwable $exception) use ($picea) {
|
|
|
|
return new HtmlResponse($picea->renderHtml('lean/error/500', [
|
|
|
|
'title' => "Une erreur s'est produite lors de l'exécution du script.",
|
|
|
|
'subtitle' => "Êtes-vous connecté avec le bon compte ?",
|
|
|
|
'message' => $exception->getMessage(),
|
|
|
|
'exception' => $exception,
|
|
|
|
]));
|
|
|
|
};
|
|
|
|
},
|
2023-01-26 13:28:36 +00:00
|
|
|
|
|
|
|
'routes.caching' => create(Kash\ApcuCache::class)->constructor(get(Kash\CacheInvalidator::class), "lean.routes", random_int(3600, 7200)),
|
|
|
|
'breadcrumbs.caching' => create(Kash\ApcuCache::class)->constructor(get(Kash\CacheInvalidator::class), "lean.breadcrumbs", random_int(3600, 7200)),
|
|
|
|
'ulmus.caching' => create(Kash\ApcuCache::class)->constructor( get(Kash\CacheInvalidator::class), "ulmus.entities", random_int(3600, 7200)),
|
2023-01-26 18:48:49 +00:00
|
|
|
'cronard.caching' => create(Kash\ApcuCache::class)->constructor( get(Kash\CacheInvalidator::class), "ulmus.entities", random_int(3600, 7200)),
|
2023-01-26 13:28:36 +00:00
|
|
|
];
|