diff --git a/halfapi/half_domain.py b/halfapi/half_domain.py index 85309be..035aaa4 100644 --- a/halfapi/half_domain.py +++ b/halfapi/half_domain.py @@ -83,7 +83,7 @@ class HalfDomain(Starlette): 'id': self.id, 'version': self.version, 'halfapi_version': self.halfapi_version, - 'config': self.config.get('domain', {}).get(self.name, {}).get('config', {}) + 'config': self.config['domain'][self.name] } }) ] diff --git a/halfapi/lib/domain_middleware.py b/halfapi/lib/domain_middleware.py index f152dd6..8a37b00 100644 --- a/halfapi/lib/domain_middleware.py +++ b/halfapi/lib/domain_middleware.py @@ -22,10 +22,15 @@ class DomainMiddleware(BaseHTTPMiddleware): """ logger.info('DomainMiddleware app:%s domain:%s', app, domain) super().__init__(app) - self.domain = domain + self.domain = domain.copy() + self.name = domain['name'] self.request = None + @property + def config(self): + return { **self.domain['config'] } + async def dispatch(self, request: Request, call_next: RequestResponseEndpoint) -> Response: """