File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313DEFAULT_DATABASE_PATH = DATABASE_DIR / TRANSCRIPTS_DB
1414DEFAULT_DB_DRIVER = "sqlite+aiosqlite"
1515
16+ APP_ENV = "APP_ENV"
17+ DEVELOPMENT = "DEVELOPMENT"
18+
1619# Score consts
1720MAX_SCORE = 1.0
1821MIN_SCORE = 0.0
Original file line number Diff line number Diff line change 11from contextlib import asynccontextmanager
2+ from os import getenv
23from os import remove
4+ from os .path import exists
35from typing import TypedDict
46
57from fastapi import FastAPI
1214from sqlalchemy .ext .asyncio import async_sessionmaker
1315
1416from lingua_loop .api .routers import transcript
17+ from lingua_loop .constants import APP_ENV
18+ from lingua_loop .constants import DEVELOPMENT
1519from lingua_loop .constants import STATIC_DIR
1620from lingua_loop .constants import TEMPLATES_DIR
1721from lingua_loop .db .session import create_db_and_tables
@@ -31,7 +35,8 @@ async def lifespan(app: FastAPI):
3135 await create_db_and_tables (async_engine = async_engine )
3236 yield {"async_session_maker" : async_session_maker }
3337 await shutdown (async_engine = async_engine )
34- if async_engine .url .database : # TODO: basically in mem db for now
38+ assert async_engine .url .database
39+ if not getenv (APP_ENV ) == DEVELOPMENT and exists (async_engine .url .database ):
3540 remove (async_engine .url .database )
3641
3742
You can’t perform that action at this time.
0 commit comments