mirror of
https://github.com/sfiorini/iptv-server.git
synced 2026-04-11 10:40:45 +00:00
Replaced env variable DATABASE_PATH with DATA_PATH and DATABASE_FILENAME
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import aiosqlite
|
||||
from dotenv import load_dotenv
|
||||
from config import DATABASE_PATH
|
||||
from pathlib import Path
|
||||
from config import DATABASE_FILENAME, DATA_PATH
|
||||
|
||||
async def get_db():
|
||||
async with aiosqlite.connect(DATABASE_PATH) as db:
|
||||
# Build the full database path
|
||||
db_path = Path(DATA_PATH) / DATABASE_FILENAME
|
||||
|
||||
# Ensure the directory exists
|
||||
db_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
async with aiosqlite.connect(db_path) as db:
|
||||
# Enable WAL mode for better concurrency
|
||||
await db.execute("PRAGMA journal_mode=WAL;")
|
||||
await db.execute("""
|
||||
|
||||
Reference in New Issue
Block a user