[middleware] fix DomainMiddleware constructor for 0.35

This commit is contained in:
maxime 2024-05-28 02:19:34 +02:00
parent b683e80959
commit 8506aa5322
Signed by untrusted user who does not match committer: masq
GPG Key ID: A6BA8DA755BB4490
2 changed files with 5 additions and 5 deletions

View File

@ -14,7 +14,6 @@ from starlette.applications import Starlette
from starlette.middleware import Middleware from starlette.middleware import Middleware
from starlette.routing import Router, Route from starlette.routing import Router, Route
from starlette.schemas import SchemaGenerator from starlette.schemas import SchemaGenerator
from .lib.responses import ORJSONResponse
from .lib.acl import AclRoute from .lib.acl import AclRoute
@ -84,15 +83,16 @@ class HalfDomain(Starlette):
super().__init__( super().__init__(
routes=self.gen_domain_routes(), routes=self.gen_domain_routes(),
middleware=[ middleware=[
(DomainMiddleware, { Middleware(
'domain': { DomainMiddleware,
domain={
'name': self.name, 'name': self.name,
'id': self.id, 'id': self.id,
'version': self.version, 'version': self.version,
'halfapi_version': self.halfapi_version, 'halfapi_version': self.halfapi_version,
'config': self.config.get('domain', {}).get(self.name, {}).get('config', {}) 'config': self.config.get('domain', {}).get(self.name, {}).get('config', {})
} }
}) )
] ]
) )

View File

@ -17,7 +17,7 @@ class DomainMiddleware(BaseHTTPMiddleware):
- acl - acl
""" """
def __init__(self, app, domain): def __init__(self, app, domain=None):
""" app: HalfAPI instance """ app: HalfAPI instance
""" """
logger.info('DomainMiddleware app:%s domain:%s', app, domain) logger.info('DomainMiddleware app:%s domain:%s', app, domain)