Skip to content

Commit

Permalink
Removed github auth requirements in development mode
Browse files Browse the repository at this point in the history
Signed-off-by: AyishikD <[email protected]>
  • Loading branch information
AyishikD committed Sep 12, 2024
1 parent 9280333 commit e908b25
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/teuthology_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,29 @@
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):
"""
GET route for root.
"""
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=["*"],
Expand All @@ -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)
app.include_router(logout.router)

0 comments on commit e908b25

Please sign in to comment.