Fix: Use get_settings() instead of settings (correct import)
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled
This commit is contained in:
@ -87,18 +87,14 @@ class ZoneSyncResult:
|
||||
|
||||
async def get_db_session():
|
||||
"""Create async database session"""
|
||||
# Read DATABASE_URL from .env file directly (avoids import issues)
|
||||
env_file = Path("/home/user/pounce/backend/.env")
|
||||
db_url = "sqlite+aiosqlite:///./domainwatch.db" # default
|
||||
from app.config import get_settings
|
||||
|
||||
if env_file.exists():
|
||||
for line in env_file.read_text().splitlines():
|
||||
if line.startswith("DATABASE_URL="):
|
||||
url = line.split("=", 1)[1].strip()
|
||||
# Convert to async SQLite URL
|
||||
if "sqlite://" in url:
|
||||
db_url = url.replace("sqlite://", "sqlite+aiosqlite://")
|
||||
break
|
||||
settings = get_settings()
|
||||
db_url = settings.database_url
|
||||
|
||||
# Ensure we use async SQLite driver
|
||||
if "sqlite://" in db_url and "aiosqlite" not in db_url:
|
||||
db_url = db_url.replace("sqlite://", "sqlite+aiosqlite://")
|
||||
|
||||
engine = create_async_engine(db_url)
|
||||
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
||||
|
||||
Reference in New Issue
Block a user