[middleware] fix DomainMiddleware constructor for 0.35
This commit is contained in:
parent
6057d9a2c6
commit
7564a56bda
|
@ -11,6 +11,7 @@ from types import ModuleType, FunctionType
|
|||
from schema import SchemaError
|
||||
|
||||
from starlette.applications import Starlette
|
||||
from starlette.middleware import Middleware
|
||||
from starlette.routing import Router
|
||||
|
||||
import yaml
|
||||
|
@ -76,15 +77,16 @@ class HalfDomain(Starlette):
|
|||
super().__init__(
|
||||
routes=self.gen_domain_routes(),
|
||||
middleware=[
|
||||
(DomainMiddleware, {
|
||||
'domain': {
|
||||
Middleware(
|
||||
DomainMiddleware,
|
||||
domain={
|
||||
'name': self.name,
|
||||
'id': self.id,
|
||||
'version': self.version,
|
||||
'halfapi_version': self.halfapi_version,
|
||||
'config': self.config.get('domain', {}).get(self.name, {}).get('config', {})
|
||||
}
|
||||
})
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ class DomainMiddleware(BaseHTTPMiddleware):
|
|||
- acl
|
||||
"""
|
||||
|
||||
def __init__(self, app, domain):
|
||||
def __init__(self, app, domain=None):
|
||||
""" app: HalfAPI instance
|
||||
"""
|
||||
logger.info('DomainMiddleware app:%s domain:%s', app, domain)
|
||||
|
|
Loading…
Reference in New Issue