From e908b25167bc141c440975d065916b24879eface Mon Sep 17 00:00:00 2001 From: AyishikD <99983449+AyishikD@users.noreply.github.com> Date: Thu, 12 Sep 2024 22:40:50 +0530 Subject: [PATCH] Removed github auth requirements in development mode Signed-off-by: AyishikD <99983449+AyishikD@users.noreply.github.com> --- src/teuthology_api/main.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/teuthology_api/main.py b/src/teuthology_api/main.py index 685a6e8..037ee7c 100644 --- a/src/teuthology_api/main.py +++ b/src/teuthology_api/main.py @@ -4,14 +4,20 @@ from fastapi.middleware.cors import CORSMiddleware from dotenv import load_dotenv from starlette.middleware.sessions import SessionMiddleware + from teuthology_api.routes import suite, kill, login, logout + load_dotenv() + DEPLOYMENT = os.getenv("DEPLOYMENT", "development") SESSION_SECRET_KEY = os.getenv("SESSION_SECRET_KEY") PULPITO_URL = os.getenv("PULPITO_URL") PADDLES_URL = os.getenv("PADDLES_URL") + log = logging.getLogger(__name__) app = FastAPI() + + @app.get("/") def read_root(request: Request): """ @@ -19,7 +25,8 @@ def read_root(request: Request): """ return {"root": "success", "session": request.session.get("user", None)} if DEPLOYMENT == "development": - app.add_middleware(CORSMiddleware,allow_origins=[PULPITO_URL, PADDLES_URL], + app.add_middleware(CORSMiddleware, + allow_origins=[PULPITO_URL, PADDLES_URL], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], @@ -31,4 +38,4 @@ def read_root(request: Request): app.include_router(suite.router) app.include_router(kill.router) app.include_router(login.router) -app.include_router(logout.router) \ No newline at end of file +app.include_router(logout.router)