sghorbal commited on
Commit
363ac35
·
1 Parent(s): 723ab53

disable auth if env variables are not set

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -21,7 +21,7 @@ async def basic_auth(request: Request, call_next):
21
  auth = request.headers.get("Authorization")
22
  expected = "Basic " + base64.b64encode(f"{USERNAME}:{PASSWORD}".encode()).decode()
23
 
24
- if auth != expected:
25
  return Response(
26
  status_code=status.HTTP_401_UNAUTHORIZED,
27
  headers={"WWW-Authenticate": "Basic"},
 
21
  auth = request.headers.get("Authorization")
22
  expected = "Basic " + base64.b64encode(f"{USERNAME}:{PASSWORD}".encode()).decode()
23
 
24
+ if USERNAME and PASSWORD and auth != expected:
25
  return Response(
26
  status_code=status.HTTP_401_UNAUTHORIZED,
27
  headers={"WWW-Authenticate": "Basic"},