[conf] update code according to CONFIG in config.py

This commit is contained in:
Maxime Alves LIRMM 2020-07-10 12:57:40 +02:00
parent a9b109d17b
commit 1983383071
1 changed files with 6 additions and 5 deletions

View File

@ -6,6 +6,7 @@ from starlette.middleware.base import BaseHTTPMiddleware
from starlette.routing import Match, Mount
from starlette.types import ASGIApp, Receive, Scope, Send
from halfapi.config import CONFIG
from halfapi.models.api.view.acl import Acl as AclView
class DebugRouteException(Exception):
@ -37,10 +38,6 @@ def match_route(app: ASGIApp, scope: Scope):
table.
"""
print('3')
from ..app import CONFIG
print(CONFIG)
result = {
'domain': None,
'name': None,
@ -118,6 +115,7 @@ class AclCallerMiddleware(BaseHTTPMiddleware):
Response
"""
print('Hit AclCallerMiddleware of API')
if scope['type'] != 'http':
await self.app(scope, receive, send)
return
@ -155,4 +153,7 @@ class AclCallerMiddleware(BaseHTTPMiddleware):
else:
scope['acls'] = []
return await self.app(scope, receive, send)
elif CONFIG['DEBUG']:
scope['dev_route'] = True
res = await self.app(scope, receive, send)