Skip to content

Commit

Permalink
check auth env vars on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
alyssadai committed Jul 16, 2024
1 parent 7ee3088 commit 79d64d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from .api import utility as util
from .api.routers import attributes, query
from .api.security import check_client_id

app = FastAPI(
default_response_class=ORJSONResponse, docs_url=None, redoc_url=None
Expand Down Expand Up @@ -77,7 +78,14 @@ def overridden_redoc():

@app.on_event("startup")
async def auth_check():
"""Checks whether username and password environment variables are set."""
"""
Checks whether authentication has been enabled for API queries and whether the
username and password environment variables for the graph backend have been set.
TODO: Refactor once startup events have been replaced by lifespan event
"""
check_client_id()

if (
# TODO: Check if this error is still raised when variables are empty strings
os.environ.get(util.GRAPH_USERNAME.name) is None
Expand Down

0 comments on commit 79d64d5

Please sign in to comment.