updated Identity and managment service
This commit is contained in:
@@ -3,11 +3,12 @@ from fastapi import FastAPI, Request
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import RedirectResponse
|
||||
|
||||
cluster_is_set = False
|
||||
|
||||
def create_events_if_any_cluster_set():
|
||||
import Events
|
||||
|
||||
if not Events.__all__:
|
||||
global cluster_is_set
|
||||
if not Events.__all__ or cluster_is_set:
|
||||
return
|
||||
|
||||
router_cluster_stack: list[RouterCluster] = [
|
||||
@@ -18,12 +19,13 @@ def create_events_if_any_cluster_set():
|
||||
router_cluster.event_clusters.values()
|
||||
)
|
||||
for event_cluster in event_cluster_stack:
|
||||
print(f"Creating event:", event_cluster.name)
|
||||
try:
|
||||
event_cluster.set_events_to_database()
|
||||
except Exception as e:
|
||||
print(f"Error creating event cluster: {e}")
|
||||
|
||||
cluster_is_set = True
|
||||
|
||||
|
||||
def create_app():
|
||||
from ApiDefaults.open_api_creator import create_openapi_schema
|
||||
@@ -58,6 +60,7 @@ def create_app():
|
||||
|
||||
route_register = RouteRegisterController(app=application, router_list=get_routes())
|
||||
application = route_register.register_routes()
|
||||
|
||||
create_events_if_any_cluster_set()
|
||||
application.openapi = lambda _=application: create_openapi_schema(_)
|
||||
return application
|
||||
|
||||
Reference in New Issue
Block a user