lean/skeleton/meta/definitions/env/prod.php

55 lines
2.4 KiB
PHP
Raw Normal View History

<?php
use Picea\Picea;
#use CSLSJ\Debogueur\DebogueurMiddleware;
use Negundo\Client\{ NegundoMiddleware, SoftwareConfig };
use
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); }
};
},
SoftwareConfig::class => create(SoftwareConfig::class)->constructor(getenv('NEGUNDO_HASH'), getenv('NEGUNDO_SERVER')),
"errorHandler" => create(NegundoMiddleware::class)->constructor(get(SoftwareConfig::class), null, get('app.errorhandler.html')),
'app.errorhandler.html' => function($c, Picea $picea) {
return function(\Throwable $exception) use ($picea) {
2023-02-08 16:36:16 +00:00
error_log($exception->getMessage());
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-27 15:42:33 +00:00
'cronard.caching' => create(Kash\ApcuCache::class)->constructor( get(Kash\CacheInvalidator::class), "lean.cronards", random_int(3600, 7200)),
'events.caching' => create(Kash\ApcuCache::class)->constructor( get(Kash\CacheInvalidator::class), "lean.events", random_int(3600, 7200)),
2023-01-26 13:28:36 +00:00
];