Skip to content

Commit

Permalink
made the .env file
Browse files Browse the repository at this point in the history
  • Loading branch information
Abbhiishek committed Feb 19, 2022
1 parent 019f6e9 commit b5ddb54
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
26 changes: 13 additions & 13 deletions app/config.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# from pydantic import BaseSettings
from pydantic import BaseSettings


# class Settings(BaseSettings):
# database_hostname: str
# database_port: str
# database_password: str
# database_name: str
# database_username: str
# secret_key: str
# algorithm: str
# access_token_expire_minutes: int
class Settings(BaseSettings):
database_hostname: str
database_port: str
database_password: str
database_name: str
database_username: str
secret_key: str
algorithm: str


# class Config:
# env_file = ".env"
class Config:
env_file = ".env"


# settings = Settings()
settings = Settings()
4 changes: 3 additions & 1 deletion app/database.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from .config import settings


SQLALCHEMY_DATABASE_URL = f'postgresql://{settings.database_username}:{settings.database_password}@{settings.database_hostname}:{settings.database_port}/{settings.database_name}'

SQLALCHEMY_DATABASE_URL = 'postgresql://postgres:abhishek1234@localhost/Sociome'
#
engine=create_engine (SQLALCHEMY_DATABASE_URL)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

Expand Down
12 changes: 6 additions & 6 deletions app/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
from fastapi import Depends, status, HTTPException
from fastapi.security import OAuth2PasswordBearer
from sqlalchemy.orm import Session
# from .config import settings
from .config import settings

oauth2_scheme = OAuth2PasswordBearer(tokenUrl='login')

SECRET_KEY= "535835638646865444444444444454545446446456464646467464567869767695468656464646764674646546467"
ALGORITHM="HS256"
# ACCESS_TOKEN_EXPIRE_MINUTES=30
# SECRET_KEY= settings.secret_key
# ALGORITHM="HS256"
# # ACCESS_TOKEN_EXPIRE_MINUTES=30

# SECRET_KEY = settings.secret_key
# ALGORITHM = settings.algorithm
SECRET_KEY = settings.secret_key
ALGORITHM = settings.algorithm
# ACCESS_TOKEN_EXPIRE_MINUTES = settings.access_token_expire_minutes


Expand Down

0 comments on commit b5ddb54

Please sign in to comment.