- WIP on moving config and definition loading into composer
This commit is contained in:
parent
2378245dbf
commit
60d4c7a900
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcnd/lean",
|
"name": "mcnd/lean",
|
||||||
"description": "A more-than-micro framework for basic apps",
|
"description": "A micro framework for rapid application development (RAD)",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"authors": [
|
"authors": [
|
||||||
|
@ -134,5 +134,29 @@
|
||||||
"post-update-cmd": [
|
"post-update-cmd": [
|
||||||
"Lean\\Composer::postUpdate"
|
"Lean\\Composer::postUpdate"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"extra" : {
|
||||||
|
"lean" : {
|
||||||
|
"autoload": {
|
||||||
|
"definitions" : [
|
||||||
|
"meta/definitions/software.php",
|
||||||
|
"meta/definitions/authorize.php",
|
||||||
|
"meta/definitions/cli.php",
|
||||||
|
"meta/definitions/cronard.php",
|
||||||
|
"meta/definitions/email.php",
|
||||||
|
"meta/definitions/event.php",
|
||||||
|
"meta/definitions/http.php",
|
||||||
|
"meta/definitions/language.php",
|
||||||
|
"meta/definitions/negundo.php",
|
||||||
|
"meta/definitions/routes.php",
|
||||||
|
"meta/definitions/software.php",
|
||||||
|
"meta/definitions/storage.php",
|
||||||
|
"meta/definitions/template.php",
|
||||||
|
],
|
||||||
|
"config": [
|
||||||
|
"meta/config.php"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'ulmus' => [
|
||||||
|
'connections' => [
|
||||||
|
'sqlite' => [
|
||||||
|
'adapter' => 'SQLite',
|
||||||
|
'path' => getenv('PROJECT_PATH') . DIRECTORY_SEPARATOR . "var/lean.sqlite3",
|
||||||
|
'pragma_begin' => "journal_mode=WAL",
|
||||||
|
'pragma_close' => "analysis_limit=500,optimize",
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Taxus\Privilege;
|
||||||
use function DI\autowire, DI\create, DI\get;
|
use function DI\autowire, DI\create, DI\get;
|
||||||
|
|
||||||
use TheBugs\JavascriptMiddleware;
|
use TheBugs\JavascriptMiddleware;
|
||||||
|
@ -64,6 +65,13 @@ return [
|
||||||
'routes' => [],
|
'routes' => [],
|
||||||
|
|
||||||
'cronard' => [],
|
'cronard' => [],
|
||||||
|
|
||||||
|
'taxus' => [
|
||||||
|
[ new Privilege("dev", "Is a developper of this application."), "is_dev" ],
|
||||||
|
[ new Privilege("admin", "Can manage mostly everything from this application."), "is_admin" ],
|
||||||
|
[ new Privilege("user", "Is an authenticated user."), "is_user" ],
|
||||||
|
[ new Privilege("anonymous", "Is an anonymous (unauthenticated) user."), "is_anonymous" ],
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
Lean::class => autowire(Lean::class),
|
Lean::class => autowire(Lean::class),
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
|
use Ulmus\ConnectionAdapter,
|
||||||
|
Ulmus\Container\AdapterProxy;
|
||||||
|
|
||||||
|
use Storage\Session;
|
||||||
|
|
||||||
|
use function DI\autowire, DI\create, DI\get;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'lean:adapter.sqlite' => function($c) {
|
||||||
|
$adapter = new ConnectionAdapter('sqlite', $c->get('config')['ulmus'], true);
|
||||||
|
$adapter->resolveConfiguration();
|
||||||
|
|
||||||
|
return $adapter;
|
||||||
|
}
|
||||||
|
];
|
|
@ -93,6 +93,11 @@ class Lean
|
||||||
return array_merge(...array_map(fn($app) => $app->events ?? [], $this->applications));
|
return array_merge(...array_map(fn($app) => $app->events ?? [], $this->applications));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTaxusPrivileges() : array
|
||||||
|
{
|
||||||
|
return array_merge(...array_map(fn($app) => $app->taxus ?? [], $this->applications));
|
||||||
|
}
|
||||||
|
|
||||||
public function getEntities() : array
|
public function getEntities() : array
|
||||||
{
|
{
|
||||||
return array_merge(...array_map(fn($app) => $app->entities ?? [], $this->applications));
|
return array_merge(...array_map(fn($app) => $app->entities ?? [], $this->applications));
|
||||||
|
@ -152,6 +157,8 @@ class Lean
|
||||||
|
|
||||||
public static function definitions() : array
|
public static function definitions() : array
|
||||||
{
|
{
|
||||||
|
return [];
|
||||||
|
|
||||||
$path = dirname(__DIR__) . "/meta/definitions/";
|
$path = dirname(__DIR__) . "/meta/definitions/";
|
||||||
|
|
||||||
return array_replace(
|
return array_replace(
|
||||||
|
@ -164,8 +171,8 @@ class Lean
|
||||||
require($path . "language.php"),
|
require($path . "language.php"),
|
||||||
class_exists(\Negundo\Client\NegundoMiddleware::class) ? require($path . "negundo.php") : [],
|
class_exists(\Negundo\Client\NegundoMiddleware::class) ? require($path . "negundo.php") : [],
|
||||||
require($path . "routes.php"),
|
require($path . "routes.php"),
|
||||||
# require($path . "security.php"),
|
|
||||||
require($path . "software.php"),
|
require($path . "software.php"),
|
||||||
|
require($path . "storage.php"),
|
||||||
class_exists(\Picea\Picea::class) ? require($path . "template.php") : [],
|
class_exists(\Picea\Picea::class) ? require($path . "template.php") : [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue