Commit e635cd13 authored by Moreau Elise's avatar Moreau Elise
Browse files

update db creation

parent 2d411bc9
......@@ -30,9 +30,9 @@ return function (ContainerBuilder $containerBuilder) {
'driver' => 'pdo_mysql',
'host' => 'db',
'port' => 3306,
'dbname' => 'covid',
'user' => 'user',
'password' => 'user',
'dbname' => getenv('MYSQL_DATABASE'),
'user' => getenv('MYSQL_USER'),
'password' => getenv('MYSQL_PASSWORD'),
//'charset' => 'utf-8'
]
],
......
......@@ -9,8 +9,13 @@ services:
build: ./
working_dir: /var/www
command: php -S 0.0.0.0:8080 -t public
env_file: .env
environment:
docker: "true"
- docker=true
- MYSQL_ROOT_PASSWORD
- MYSQL_DATABASE
- MYSQL_USER
- MYSQL_PASSWORD
ports:
- 8080:8080
volumes:
......
This diff is collapsed.
<?php
declare(strict_types=1);
namespace App\Application\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\MiddlewareInterface as Middleware;
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
use Slim\Psr7\Response;
class RequireUserMiddleware implements Middleware
{
/**
* {@inheritdoc}
*/
public function process(Request $request, RequestHandler $handler): ResponseInterface
{
if (isset($request['user'])) {
return $handler->handle($request);
}
$response = new Response();
return $response->withHeader('Location', '/login')->withStatus(302);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment