MCPcopy
hub / github.com/apache/caldera / initialize

Function initialize

tests/conftest.py:364–402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

362 return app
363
364 async def initialize():
365 with open(Path(__file__).parents[1] / 'conf' / 'default.yml', 'r') as fle:
366 BaseWorld.apply_config('main', yaml.safe_load(fle))
367 with open(Path(__file__).parents[1] / 'conf' / 'payloads.yml', 'r') as fle:
368 BaseWorld.apply_config('payloads', yaml.safe_load(fle))
369
370 app_svc = AppService(web.Application(client_max_size=5120 ** 2))
371 _ = DataService()
372 _ = RestService()
373 _ = PlanningService()
374 _ = KnowledgeService()
375 _ = LearningService()
376 auth_svc = AuthService()
377 _ = FileSvc()
378 _ = EventService()
379 services = app_svc.get_services()
380 os.chdir(str(Path(__file__).parents[1]))
381
382 _ = await RestApi(services).enable()
383 await app_svc.register_contacts()
384 await auth_svc.apply(app_svc.application, auth_svc.get_config('users'))
385 await auth_svc.set_login_handlers(services)
386
387 app_svc.register_subapp('/api/v2', make_app(svcs=services))
388 aiohttp_apispec.setup_aiohttp_apispec(
389 app=app_svc.application,
390 title='Caldera',
391 version=version.get_version(),
392 swagger_path='/api/docs',
393 url='/api/docs/swagger.json',
394 static_path='/static/swagger'
395 )
396 app_svc.application.middlewares.append(apispec_request_validation_middleware)
397 app_svc.application.middlewares.append(validation_middleware)
398 templates = ['plugins/%s/templates' % p.lower() for p in app_svc.get_config('plugins')]
399 templates.append('plugins/magma/dist')
400 templates.append("templates")
401 aiohttp_jinja2.setup(app_svc.application, loader=jinja2.FileSystemLoader(templates))
402 return app_svc
403
404 app_svc = await initialize()
405 app = app_svc.application

Callers 1

api_v2_clientFunction · 0.70

Calls 15

register_contactsMethod · 0.95
applyMethod · 0.95
set_login_handlersMethod · 0.95
register_subappMethod · 0.95
AppServiceClass · 0.90
DataServiceClass · 0.90
RestServiceClass · 0.90
PlanningServiceClass · 0.90
KnowledgeServiceClass · 0.90
LearningServiceClass · 0.90
AuthServiceClass · 0.90
FileSvcClass · 0.90

Tested by

no test coverage detected