Exemple #1
0
def custom_test_server():
    container = ServerContainer()
    container.wire(modules=[users])
    app = FastAPI()
    app.container = container
    app.include_router(users.router)
    yield app
def custom_test_server():
    container = ServerContainer()
    container.wire(modules=[authenticate])
    app = FastAPI()
    app.container = container
    app.include_router(authenticate.router)
    yield app
Exemple #3
0
def get_app():
    core = Core()
    core.wire(packages=[router], modules=[sys.modules[__name__]])
    appf = FastAPI()
    appf.container = core
    appf.include_router(message_router)
    return appf
Exemple #4
0
def custom_test_server():
    container = ServerContainer()
    container.wire(modules=[emissions])
    app = FastAPI()
    app.container = container
    app.include_router(emissions.router)
    add_pagination(app)
    yield app
def create_app() -> FastAPI:
    container = Container()
    container.config.giphy.api_key.from_env("GIPHY_API_KEY")

    app = FastAPI()
    app.container = container
    app.include_router(endpoints.router)
    return app
def create_app() -> FastAPI:
    container = Container()
    container.config.from_yaml("config.yml")
    container.wire(modules=[controller])

    app = FastAPI()
    app.include_router(controller.router)
    app.container = container
    return app
Exemple #7
0
def create_app() -> FastAPI:
    container = Container()
    container.config.from_yaml('config.yml')
    container.config.giphy.api_key.from_env('GIPHY_API_KEY')
    container.wire(modules=[endpoints])

    app = FastAPI()
    app.container = container
    app.add_api_route('/', endpoints.index)
    return app
Exemple #8
0
def create_app() -> FastAPI:
    container = Container()

    db = container.db()
    db.create_database()

    app = FastAPI()
    app.container = container
    app.include_router(endpoints.router)
    return app
def create_app() -> FastAPI:
    container = Container()
    container.config.from_yaml('config.yml')
    container.wire(modules=[endpoints])

    db = container.db()
    db.create_database()

    app = FastAPI()
    app.container = container
    app.include_router(endpoints.router)
    return app
Exemple #10
0
def init_server(container):
    server = FastAPI(dependencies=[Depends(get_query_token)])
    server.container = container
    server.include_router(users.router)
    server.include_router(authenticate.router)
    server.include_router(organizations.router)
    server.include_router(teams.router)
    server.include_router(projects.router)
    server.include_router(experiments.router)
    server.include_router(experiments.router)
    server.include_router(runs.router)
    server.include_router(emissions.router)
    add_pagination(server)
    return server
Exemple #11
0
def create_app() -> FastAPI:
    container = Container()
    container.wire(modules=[endpoints])

    app = FastAPI(description='This',
                  version='1.0.0',
                  title='Storage API',
                  contact={'email': '*****@*****.**'},
                  license={
                      'name': 'Apache 2.0',
                      'url': 'http://www.apache.org/licenses/LICENSE-2.0.html',
                  })
    app.container = container
    app.include_router(endpoints.router)
    return app
Exemple #12
0
def create_app() -> FastAPI:


    app = FastAPI()
    app.container = Container()
    config_path = path.join(ROOT_DIR, "config.yaml")
    app.container.config.from_yaml(config_path)
    app.container.wire(modules=[ep])
    # with open(cfg_path, 'r') as stream:
    #     cfg = yaml.load(stream, Loader=yaml.FullLoader)
    # print(cfg)


    frontend=app.container.frontend()
    frontend_t = Thread(target=start_frontend, args=(frontend,), daemon=True)
    frontend_t.start()
    # frontend.run()
    # frontend.async_run(async_lib='trio')
    # trio.run(partial(frontend.async_run, async_lib='trio'))
    # asyncio.create_task(frontend.async_run())
    # loop = asyncio.get_event_loop()
    # loop.run_until_complete(frontend.async_run())

    print("Frontend started")

    # print("Adding middleware....")
    # # app.add_middleware(
    #     CORSMiddleware,
    #     allow_origins=["*"],
    #     allow_credentials=True,
    #     allow_methods=["*"],
    #     allow_headers=["*"],
    # )

    # @app.put("/presence_out_of_bounds/")
    # async def presence_out_of_bounds(am:str=Body(...)):
    #     return frontend.presence_out_of_bounds(am)


    # @app.put("/presence_detected/")
    # async def presence_detected(am:AccessModel):
    #     frontend.presence_detected(am)

    app.include_router(ep.router)

    return app
Exemple #13
0
def create_app() -> FastAPI:
    router_modules = [
        auth.external_interface.routers,
        health.external_interface.routers,
        users.external_interface.routers,
        reviews.external_interface.routers,
        wishes.external_interface.routers,
        drinks.external_interface.routers,
    ]

    container = Container()
    container.wire(modules=router_modules)
    container.settings.from_pydantic(Settings())

    db = container.db()
    db.create_database()

    app = FastAPI()
    app.container = container
    for router_module in router_modules:
        app.include_router(router_module.router)
    return app
Exemple #14
0
def create_app() -> FastAPI:
    container = Container()
    container.config.from_yaml('config/config.yaml')
    container.wire(modules=[
        application_controller, environment_controller, variable_controller,
        configuration_controller, change_history_controller, dependencies
    ])

    app = FastAPI(title="Configuration Keeper",
                  description="""This is a project whose main idea 
            is to give developers a single place to store 
            the configurations of their applications with 
            the ability to customize them and then pull 
            them into their projects.""",
                  version="0.3.0",
                  openapi_tags=tags_metadata)
    app.container = container
    app.include_router(application_controller.router)
    app.include_router(environment_controller.router)
    app.include_router(variable_controller.router)
    app.include_router(configuration_controller.router)
    app.include_router(change_history_controller.router)

    return app
from fastapi import FastAPI
from mangum import Mangum

from apps.backend import clusters
from apps.backend.containers import Container

container = Container()
container.wire(modules=[clusters])

app = FastAPI()
app.container = container
app.include_router(clusters.router, prefix="/clusters")

lambda_handler = Mangum(app, api_gateway_base_path="api", lifespan="off")