Files
This commit is contained in:
11
setup/setups/01_env.php
Normal file
11
setup/setups/01_env.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
Zeuxisoo\Whoops\Slim\WhoopsMiddleware::class => function(Container $c) {
|
||||
return new Zeuxisoo\Whoops\Slim\WhoopsMiddleware([
|
||||
'enable' => $c->get('debug'),
|
||||
'editor' => 'vscode'
|
||||
]);
|
||||
}
|
||||
];
|
42
setup/setups/02_web.php
Normal file
42
setup/setups/02_web.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
use Psr\Container\ContainerInterface as Container;
|
||||
|
||||
return [
|
||||
Slim\Views\Blade::class => function(Container $c) {
|
||||
return new Slim\Views\Blade(
|
||||
$c->get('folders')->templates,
|
||||
$c->get('folders')->cache,
|
||||
null,
|
||||
[
|
||||
'urls' => $c->get('urls'),
|
||||
'auth' => $c->get(Incoviba\UI\Common\Service\Auth::class),
|
||||
'api_key' => $c->get('API_KEY')
|
||||
]
|
||||
);
|
||||
},
|
||||
Psr\Http\Client\ClientInterface::class => function(Container $c) {
|
||||
return new GuzzleHttp\Client([
|
||||
'base_uri' => $c->get('urls')->api,
|
||||
'headers' => ['Authorization' => 'Bearer ' . $c->get('API_KEY')]
|
||||
]);
|
||||
},
|
||||
Incoviba\UI\Common\Service\Auth::class => function(Container $c) {
|
||||
return new Incoviba\UI\Common\Service\Auth(
|
||||
$c->get(Psr\Http\Client\ClientInterface::class),
|
||||
$c->get('cookie_name')
|
||||
);
|
||||
},
|
||||
Incoviba\UI\Common\Middleware\Auth::class => function(Container $c) {
|
||||
return new Incoviba\UI\Common\Middleware\Auth(
|
||||
$c->get(Incoviba\UI\Common\Service\Auth::class),
|
||||
$c->get(Nyholm\Psr7\Factory\Psr17Factory::class),
|
||||
['/', '/auth/login']
|
||||
);
|
||||
},
|
||||
Incoviba\UI\Common\Middleware\NotFound::class => function(Container $c) {
|
||||
return new Incoviba\UI\Common\Middleware\NotFound(
|
||||
$c->get(Nyholm\Psr7\Factory\Psr17Factory::class),
|
||||
$c->get(Slim\Views\Blade::class)
|
||||
);
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user