From 70ee654ed99cc159e17b25f3ca5eafb93f57c45c Mon Sep 17 00:00:00 2001 From: Maxime Alves LIRMM Date: Fri, 3 Jul 2020 11:32:18 +0200 Subject: [PATCH] DSN -> SECRET dans middleware --- halfapi/app.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/halfapi/app.py b/halfapi/app.py index 6359351..aac4fad 100644 --- a/halfapi/app.py +++ b/halfapi/app.py @@ -223,13 +223,14 @@ async def root(request): def check_conf(): if not environ.get('HALFORM_SECRET', False): - print('Missing HALFORM_SECRET variable from configuration') + environ['HALFORM_SECRET'] = 'secret' + print('Missing HALFORM_SECRET variable from configuration, seting to default') if not environ.get('HALFORM_DSN', False): print('Missing HALFORM_DSN variable from configuration') app = Starlette( middleware=[ - Middleware(AuthenticationMiddleware, backend=JWTAuthenticationBackend(secret_key=environ.get('HALFORM_DSN'))), + Middleware(AuthenticationMiddleware, backend=JWTAuthenticationBackend(secret_key=environ.get('HALFORM_SECRET'))), Middleware(AclCallerMiddleware), ], on_startup=[startup],