fix docker config
This commit is contained in:
@@ -2,13 +2,14 @@
|
|||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from db.models import Base
|
from db.models import Base
|
||||||
|
|
||||||
|
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker
|
||||||
from sqlalchemy import create_engine
|
from sqlalchemy import create_engine
|
||||||
import env_provider
|
import env_provider
|
||||||
|
from env_provider import DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
|
||||||
|
|
||||||
engine = create_engine(env_provider.DB_CONNECT_STRING)
|
engine = create_engine(f"mysql+pymysql://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}")
|
||||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def get_db():
|
def get_db():
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
|
|||||||
@@ -6,5 +6,10 @@ load_dotenv()
|
|||||||
|
|
||||||
CLIENT_ID = os.getenv("CLIENT_ID")
|
CLIENT_ID = os.getenv("CLIENT_ID")
|
||||||
CLIENT_SECRET = os.getenv("CLIENT_SECRET")
|
CLIENT_SECRET = os.getenv("CLIENT_SECRET")
|
||||||
DB_CONNECT_STRING = os.getenv("DB_CONNECT_STRING")
|
|
||||||
|
DB_HOST = os.getenv("DB_HOST")
|
||||||
|
DB_PORT = os.getenv("DB_PORT")
|
||||||
|
DB_NAME = os.getenv("DB_NAME")
|
||||||
|
DB_USER = os.getenv("DB_USER")
|
||||||
|
DB_PASSWORD = os.getenv("DB_PASSWORD")
|
||||||
SESSION_SECRET_KEY = os.getenv("SESSION_SECRET_KEY")
|
SESSION_SECRET_KEY = os.getenv("SESSION_SECRET_KEY")
|
||||||
Reference in New Issue
Block a user