Ibraaheem commited on
Commit
b8a8faa
·
1 Parent(s): 7df0fb6

Update private_gpt/server/utils/authentication.py

Browse files
private_gpt/server/utils/authentication.py CHANGED
@@ -6,13 +6,13 @@ from passlib.context import CryptContext
6
  from fastapi.security import OAuth2PasswordRequestForm, OAuth2PasswordBearer
7
  from jose import jwt, JWTError
8
  from pydantic import BaseModel
9
-
10
  router = APIRouter(
11
  prefix='/v1/auth',
12
  tags=['auth']
13
  )
14
 
15
- SECRET_KEY = PASSWORD
16
  ALGORITHM = 'HS256'
17
 
18
  bcrypt_context = CryptContext(schemes=['bcrypt'], deprecated='auto')
@@ -21,13 +21,13 @@ oauth2_bearer = OAuth2PasswordBearer(tokenUrl='/v1/auth/token')
21
  hardcoded_users = [
22
  { "id": 1,
23
  "username": "test",
24
- "password_hash": bcrypt_context.hash(USER_HASH),
25
  "role": "user"
26
  },
27
 
28
  { "id": 2,
29
  "username": "admin",
30
- "password_hash": bcrypt_context.hash(ADMIN_HASH),
31
  "role": "admin"
32
  },
33
 
 
6
  from fastapi.security import OAuth2PasswordRequestForm, OAuth2PasswordBearer
7
  from jose import jwt, JWTError
8
  from pydantic import BaseModel
9
+ import os
10
  router = APIRouter(
11
  prefix='/v1/auth',
12
  tags=['auth']
13
  )
14
 
15
+ SECRET_KEY = os.environ.get("PASSWORD")
16
  ALGORITHM = 'HS256'
17
 
18
  bcrypt_context = CryptContext(schemes=['bcrypt'], deprecated='auto')
 
21
  hardcoded_users = [
22
  { "id": 1,
23
  "username": "test",
24
+ "password_hash": bcrypt_context.hash(os.environ.get("USER_HASH")),
25
  "role": "user"
26
  },
27
 
28
  { "id": 2,
29
  "username": "admin",
30
+ "password_hash": bcrypt_context.hash(os.environ.get("ADMIN_HASH")),
31
  "role": "admin"
32
  },
33