feat(register): register the middleware
This commit is contained in:
parent
6256b3377d
commit
da75ba746c
@ -11,6 +11,7 @@ from webapi.providers import message_queue
|
|||||||
from webapi.providers import exception_handler
|
from webapi.providers import exception_handler
|
||||||
from webapi.providers import probes
|
from webapi.providers import probes
|
||||||
from webapi.providers import metrics
|
from webapi.providers import metrics
|
||||||
|
from webapi.providers import middleware
|
||||||
from .freeleaps_app import FreeleapsApp
|
from .freeleaps_app import FreeleapsApp
|
||||||
from common.config.app_settings import app_settings
|
from common.config.app_settings import app_settings
|
||||||
|
|
||||||
@ -22,6 +23,11 @@ def create_app() -> FastAPI:
|
|||||||
app = FreeleapsApp()
|
app = FreeleapsApp()
|
||||||
|
|
||||||
register_logger()
|
register_logger()
|
||||||
|
|
||||||
|
# 1. Register middleware firstly
|
||||||
|
register(app, middleware)
|
||||||
|
|
||||||
|
# 2. Register other providers
|
||||||
register(app, exception_handler)
|
register(app, exception_handler)
|
||||||
# Register probe APIs if enabled
|
# Register probe APIs if enabled
|
||||||
if app_settings.PROBES_ENABLED:
|
if app_settings.PROBES_ENABLED:
|
||||||
|
|||||||
9
apps/notification/webapi/providers/middleware.py
Normal file
9
apps/notification/webapi/providers/middleware.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
from webapi.middleware.api_key_middleware import NotificationServiceMiddleware
|
||||||
|
|
||||||
|
|
||||||
|
def register(app):
|
||||||
|
"""
|
||||||
|
Register middleware to FastAPI application
|
||||||
|
"""
|
||||||
|
# Register API Key middleware
|
||||||
|
app.add_middleware(NotificationServiceMiddleware)
|
||||||
Loading…
Reference in New Issue
Block a user