2020-12-07 14:11:29 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use function DI\autowire, DI\create, DI\get;
|
|
|
|
|
2023-02-01 18:49:45 +00:00
|
|
|
use Laminas\Diactoros\Response\HtmlResponse;
|
2020-12-07 14:11:29 +00:00
|
|
|
|
|
|
|
use TheBugs\JavascriptMiddleware;
|
|
|
|
|
2023-07-09 16:37:39 +00:00
|
|
|
|
2021-10-19 12:38:20 +00:00
|
|
|
use Cronard\CronardMiddleware,
|
|
|
|
Notes\Cronard\TaskFetcher;
|
2020-12-07 14:11:29 +00:00
|
|
|
|
|
|
|
use Lean\Lean;
|
|
|
|
|
2021-10-19 12:38:20 +00:00
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
|
|
|
2020-12-07 14:11:29 +00:00
|
|
|
use Storage\Cookie,
|
|
|
|
Storage\Session,
|
|
|
|
Storage\SessionMiddleware;
|
|
|
|
|
|
|
|
return [
|
|
|
|
'lean.default' => [
|
|
|
|
'picea' => [
|
|
|
|
'context' => "Lean\\View",
|
|
|
|
|
|
|
|
'view' => [
|
|
|
|
[
|
|
|
|
'path' => getenv("VIEW_PATH"),
|
|
|
|
'order' => 10,
|
|
|
|
],
|
|
|
|
[
|
2022-11-29 19:53:41 +00:00
|
|
|
'path' => getenv("PROJECT_PATH") . implode(DIRECTORY_SEPARATOR, [ "", "vendor", "mcnd" , "lean" , "view" ]),
|
2020-12-07 14:11:29 +00:00
|
|
|
'order' => 99,
|
|
|
|
],
|
|
|
|
],
|
2021-02-16 03:10:04 +00:00
|
|
|
|
|
|
|
'extensions' => [],
|
2020-12-07 14:11:29 +00:00
|
|
|
],
|
|
|
|
|
2021-01-22 14:38:17 +00:00
|
|
|
'ulmus' => [],
|
2020-12-07 14:11:29 +00:00
|
|
|
|
|
|
|
'tell' => [
|
|
|
|
'json' => [
|
|
|
|
[
|
|
|
|
'path' => getenv("META_PATH") . "/i18n",
|
|
|
|
'order' => 10,
|
|
|
|
],
|
|
|
|
|
|
|
|
[
|
|
|
|
'path' => getenv("PROJECT_PATH") . "/vendor/mcnd/lean/meta/i18n",
|
|
|
|
'order' => 99,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
'php' => [
|
|
|
|
[
|
|
|
|
'path' => getenv("CACHE_PATH")."/i18n",
|
|
|
|
'order' => 0,
|
|
|
|
]
|
|
|
|
]
|
|
|
|
],
|
|
|
|
|
2021-01-22 14:38:17 +00:00
|
|
|
'routes' => [],
|
2021-10-19 12:38:20 +00:00
|
|
|
|
|
|
|
'cronard' => [],
|
2020-12-07 14:11:29 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
Lean::class => autowire(Lean::class),
|
|
|
|
|
|
|
|
JavascriptMiddleware::class => create(JavascriptMiddleware::class),
|
|
|
|
|
2022-05-11 15:21:51 +00:00
|
|
|
Cookie::class => create(Cookie::class)->constructor([ 'secure' => true, 'path' => getenv('URL_BASE') ?: '/', ], getenv("LEAN_RANDOM")),
|
2020-12-07 14:11:29 +00:00
|
|
|
|
2022-05-11 15:21:51 +00:00
|
|
|
Session::class => create(Session::class)->constructor(get(Cookie::class), [ 'path' => getenv('URL_BASE') ?: '/', ]),
|
2020-12-07 14:11:29 +00:00
|
|
|
|
2022-05-11 12:27:47 +00:00
|
|
|
SessionMiddleware::class => create(SessionMiddleware::class)->constructor(get(Cookie::class), [ 'name' => "lean_sess_" . substr(md5(getenv("LEAN_RANDOM")), 0, 12), 'path' => getenv('URL_BASE') ?: '/' ]),
|
2020-12-07 14:11:29 +00:00
|
|
|
|
|
|
|
'git.commit' => function($c) {
|
|
|
|
if ( getenv("DEBUG") ) {
|
|
|
|
return uniqid("debug_");
|
|
|
|
}
|
|
|
|
|
|
|
|
$gitdir = getenv("PROJECT_PATH") . DIRECTORY_SEPARATOR . ".git" . DIRECTORY_SEPARATOR;
|
|
|
|
|
2021-02-16 03:10:04 +00:00
|
|
|
if ( file_exists($gitdir . "HEAD") ) {
|
|
|
|
if (false !== ($currentBranch = file_get_contents($gitdir . "HEAD"))) {
|
|
|
|
$file = explode(": ", $currentBranch)[1];
|
|
|
|
$path = $gitdir . str_replace("/", DIRECTORY_SEPARATOR, trim($file, " \t\n\r"));
|
2020-12-07 14:11:29 +00:00
|
|
|
|
2021-02-16 03:10:04 +00:00
|
|
|
return trim(file_get_contents($path), " \t\n\r");
|
|
|
|
}
|
2020-12-07 14:11:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return "gitless-project";
|
|
|
|
},
|
2023-01-26 13:28:36 +00:00
|
|
|
|
|
|
|
Kash\CacheInvalidator::class => create(Kash\CacheInvalidator::class)->constructor(getenv('CACHE_PATH')."/version.cache", (bool) getenv('DEBUG')),
|
2020-12-07 14:11:29 +00:00
|
|
|
];
|