Put users_db into json file

This commit is contained in:
Jimmy 2021-12-04 01:42:26 +13:00
parent a9ca41a924
commit fe1219d5a0
2 changed files with 11 additions and 11 deletions

View File

@ -7,6 +7,7 @@ from jose import JWTError, jwt
from passlib.context import CryptContext
from pydantic import BaseModel
from os import getenv
import json
# to get a string like this run:
# openssl rand -hex 32
@ -14,17 +15,7 @@ SECRET_KEY = getenv("SECRET_KEY")
ALGORITHM = getenv("ALGORITHM")
ACCESS_TOKEN_EXPIRE_MINUTES = int(getenv("ACCESS_TOKEN_EXPIRE_MINUTES"))
fake_users_db = {
"johndoe": {
"username": "johndoe",
"full_name": "John Doe",
"email": "johndoe@example.com",
"hashed_password": "$2b$12$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW",
"disabled": False,
}
}
fake_users_db = json.load(open("app/users.json"))
class Token(BaseModel):
access_token: str

9
app/users.json Normal file
View File

@ -0,0 +1,9 @@
{
"johndoe": {
"username": "johndoe",
"full_name": "John Doe",
"email": "johndoe@example.com",
"hashed_password": "$2b$12$EixZaYVK1fsbw1ZfbX3OXePaWxn96p36WQoeG6Lruj3vjPGga31lW",
"disabled": "False"
}
}