43 lines
1.0 KiB
Python
43 lines
1.0 KiB
Python
"""
|
|
Route configuration and factory module.
|
|
Handles dynamic route creation based on configurations.
|
|
"""
|
|
|
|
from typing import Optional
|
|
|
|
from Events.Engine.set_defaults.run import get_cluster_controller_group
|
|
from Events.Engine.set_defaults.setClusters import (
|
|
PrepareRouting,
|
|
SetItems2Redis,
|
|
PrepareEvents,
|
|
)
|
|
|
|
|
|
routers: Optional[PrepareRouting] = None
|
|
|
|
|
|
def get_all_routers() -> PrepareRouting:
|
|
"""
|
|
Get all routers and protected routes from route configurations.
|
|
|
|
Returns:
|
|
tuple: PrepareRouting
|
|
"""
|
|
global routers
|
|
if routers:
|
|
return routers
|
|
|
|
cluster_list = get_cluster_controller_group()
|
|
routers = PrepareRouting(cluster_controller_group=cluster_list)
|
|
return routers
|
|
|
|
|
|
# async def health_check(request: Request):
|
|
# """Default health check endpoint."""
|
|
# return {"status": "healthy", "message": "Service is running"}
|
|
#
|
|
#
|
|
# async def ping_test(request: Request, service_name: str = "base-router"):
|
|
# """Default ping test endpoint."""
|
|
# return {"ping": "pong", "service": service_name}
|