diff --git a/src/settings/database.py b/src/settings/database.py index c4927d5..9d85a4b 100644 --- a/src/settings/database.py +++ b/src/settings/database.py @@ -4,10 +4,16 @@ from sqlalchemy.orm import sessionmaker, declarative_base SQLALCHEMY_DATABASE_URL = os.getenv("DATABASE_URL") - -engine = create_engine( - SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} -) +ENVIRONMENT = os.getenv("ENVIRONMENT") + +if ENVIRONMENT == "development": + engine = create_engine( + SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} + ) +else: + engine = create_engine( + SQLALCHEMY_DATABASE_URL, + ) SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) Base = declarative_base()