- Added the application feature - a big reason why Lean was created in the first place.
- Began moving some repetitive parts from projects to projects into lean
This commit is contained in:
1 parent
4bd68a74f8
commit
bdb9f7f732
13 files changed
+571
-2
No files matched your search
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use function DI\autowire, DI\create, DI\get;
|
||||
|
||||
use Zend\Diactoros\Response\TextResponse;
|
||||
|
||||
use TheBugs\JavascriptMiddleware;
|
||||
|
||||
use Cronard\CronardMiddleware;
|
||||
|
||||
use Lean\Lean;
|
||||
|
||||
use Storage\Cookie,
|
||||
Storage\Session,
|
||||
Storage\SessionMiddleware;
|
||||
|
||||
return [
|
||||
'lean.default' => [
|
||||
'picea' => [
|
||||
'context' => "Lean\\View",
|
||||
|
||||
'view' => [
|
||||
[
|
||||
'path' => getenv("VIEW_PATH"),
|
||||
'order' => 10,
|
||||
],
|
||||
[
|
||||
'path' => getenv("PROJECT_PATH") . "/vendor/mcnd/lean/view/",
|
||||
'order' => 99,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'ulmus' => [
|
||||
'entities' => [ 'Growlogs\\Entity' ]
|
||||
],
|
||||
|
||||
'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,
|
||||
]
|
||||
]
|
||||
],
|
||||
|
||||
'routes' => [
|
||||
'Growlogs\\Api' => '/src/Api/',
|
||||
'Growlogs\\Dev' => '/src/Dev/',
|
||||
'Growlogs\\Web' => '/src/Web/',
|
||||
],
|
||||
],
|
||||
|
||||
Lean::class => autowire(Lean::class),
|
||||
|
||||
CronardMiddleware::class => function($c) {
|
||||
$cronardMiddleware = new CronardMiddleware(getenv('CRON_KEY'), function() : ResponseInterface {
|
||||
return new TextResponse(sprintf("%s - cron task begin...", date('Y-m-d H:i:s')));
|
||||
});
|
||||
|
||||
return $cronardMiddleware->fromFile(getenv("META_PATH")."/crontab.php");
|
||||
},
|
||||
|
||||
JavascriptMiddleware::class => create(JavascriptMiddleware::class),
|
||||
|
||||
Cookie::class => create(Cookie::class)->constructor([ 'secure' => true, 'samesite' => 'Strict' ], getenv("LEAN_RANDOM")),
|
||||
|
||||
Session::class => create(Session::class),
|
||||
|
||||
SessionMiddleware::class => create(SessionMiddleware::class)->constructor(get(Cookie::class), [ 'name' => "lean_sess_" . substr(md5(getenv("LEAN_RANDOM")), 0, 12) ]),
|
||||
|
||||
'git.commit' => function($c) {
|
||||
if ( getenv("DEBUG") ) {
|
||||
return uniqid("debug_");
|
||||
}
|
||||
|
||||
$gitdir = getenv("PROJECT_PATH") . DIRECTORY_SEPARATOR . ".git" . DIRECTORY_SEPARATOR;
|
||||
|
||||
if ( false !== ( $currentBranch = file_get_contents( $gitdir . "HEAD") ) ) {
|
||||
$file = explode(": ", $currentBranch)[1];
|
||||
$path = $gitdir . str_replace("/", DIRECTORY_SEPARATOR, trim($file, " \t\n\r"));
|
||||
|
||||
return trim(file_get_contents( $path ), " \t\n\r");
|
||||
}
|
||||
|
||||
return "gitless-project";
|
||||
},
|
||||
];
|
||||
Reference in new issue
Block a user