Use env vars
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
# openssl rand -hex 32
|
||||||
|
SECRET_KEY=
|
||||||
|
ALGORITHM=HS256
|
||||||
|
ACCESS_TOKEN_EXPIRE_MINUTES=30
|
@@ -6,12 +6,13 @@ from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
|||||||
from jose import JWTError, jwt
|
from jose import JWTError, jwt
|
||||||
from passlib.context import CryptContext
|
from passlib.context import CryptContext
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
from os import getenv
|
||||||
|
|
||||||
# to get a string like this run:
|
# to get a string like this run:
|
||||||
# openssl rand -hex 32
|
# openssl rand -hex 32
|
||||||
SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
|
SECRET_KEY = getenv("SECRET_KEY")
|
||||||
ALGORITHM = "HS256"
|
ALGORITHM = getenv("ALGORITHM")
|
||||||
ACCESS_TOKEN_EXPIRE_MINUTES = 30
|
ACCESS_TOKEN_EXPIRE_MINUTES = int(getenv("ACCESS_TOKEN_EXPIRE_MINUTES"))
|
||||||
|
|
||||||
|
|
||||||
fake_users_db = {
|
fake_users_db = {
|
||||||
|
Reference in New Issue
Block a user