Skip to content

Commit

Permalink
allow ability to add global dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rzlim08 committed Oct 3, 2024
1 parent c8b323a commit 13d2d82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions platformics/graphql_api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_graphql_name(self, obj: HasGraphQLName) -> str:
return super().get_graphql_name(obj)


def get_app(settings: APISettings, schema: strawberry.Schema, db_module: typing.Any) -> FastAPI:
def get_app(settings: APISettings, schema: strawberry.Schema, db_module: typing.Any, dependencies: typing.Optional[typing.Sequence[Depends]]) -> FastAPI:
"""
Make sure tests can get their own instances of the app.
"""
Expand All @@ -59,7 +59,7 @@ def get_app(settings: APISettings, schema: strawberry.Schema, db_module: typing.

title = settings.SERVICE_NAME
graphql_app: GraphQLRouter = GraphQLRouter(schema, context_getter=get_context)
_app = FastAPI(title=title, debug=settings.DEBUG)
_app = FastAPI(title=title, debug=settings.DEBUG, dependencies=dependencies)
_app.include_router(graphql_app, prefix="/graphql")
# Add a global settings object to the app that we can use as a dependency
_app.state.settings = settings
Expand Down

0 comments on commit 13d2d82

Please sign in to comment.