File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 2323 ) + "%2Fapi%2Fauth%2Flogin%3Fredirect_path%3D%2Fapi%2Fapi%2Fdocs%2F%26redirect_fragment%3D"
2424)
2525
26- app = FastAPI (
27- lifespan = database .lifespan ,
28- title = "CSSS Site Backend" ,
29- description = f'To login, please click <a href="{ _login_link } ">here</a><br><br>To logout from CAS click <a href="https://cas.sfu.ca/cas/logout">here</a>' ,
30- root_path = "/api"
31- )
26+ # Enable OpenAPI docs only for local development
27+ if os .environ .get ("LOCAL" ) == "true" :
28+ app = FastAPI (
29+ lifespan = database .lifespan ,
30+ title = "CSSS Site Backend" ,
31+ description = f'To login, please click <a href="{ _login_link } ">here</a><br><br>To logout from CAS click <a href="https://cas.sfu.ca/cas/logout">here</a>' ,
32+ root_path = "/api" ,
33+ )
34+ # if on production, disable vieweing the docs
35+ else :
36+ app = FastAPI (
37+ lifespan = database .lifespan ,
38+ title = "CSSS Site Backend" ,
39+ description = f'To login, please click <a href="{ _login_link } ">here</a><br><br>To logout from CAS click <a href="https://cas.sfu.ca/cas/logout">here</a>' ,
40+ root_path = "/api" ,
41+ docs_url = None , # disables Swagger UI
42+ redoc_url = None , # disables ReDoc
43+ openapi_url = None # disables OpenAPI schema
44+ )
45+
3246
3347app .include_router (auth .urls .router )
3448app .include_router (elections .urls .router )
You can’t perform that action at this time.
0 commit comments