Browse Source

Put users_db into json file

master
Jimmy 2 months ago
parent
commit
fe1219d5a0
  1. 13
      app/main.py
  2. 9
      app/users.json

13
app/main.py

@ -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

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