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