From 333e367a5b500df0bd4c5a0a14fc1e7e184f2818 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Sun, 28 Aug 2022 11:24:46 +0200 Subject: [PATCH] Improve debug mode --- app/database.py | 3 ++- app/httpsig.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/database.py b/app/database.py index 0669687..e7d07c2 100644 --- a/app/database.py +++ b/app/database.py @@ -9,6 +9,7 @@ from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from app.config import DB_PATH +from app.config import DEBUG from app.config import SQLALCHEMY_DATABASE_URL engine = create_engine( @@ -18,7 +19,7 @@ SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) DATABASE_URL = f"sqlite+aiosqlite:///{DB_PATH}" async_engine = create_async_engine( - DATABASE_URL, future=True, echo=False, connect_args={"timeout": 15} + DATABASE_URL, future=True, echo=DEBUG, connect_args={"timeout": 15} ) async_session = sessionmaker(async_engine, class_=AsyncSession, expire_on_commit=False) diff --git a/app/httpsig.py b/app/httpsig.py index 495e0cb..7691c2b 100644 --- a/app/httpsig.py +++ b/app/httpsig.py @@ -130,6 +130,7 @@ async def _get_public_key(db_session: AsyncSession, key_id: str) -> Key: k.load_pub(actor["publicKey"]["publicKeyPem"]) # Ensure the right key was fetch + # TODO: some server have the key ID `http://` but fetching it return `https` if key_id not in [k.key_id(), k.owner]: raise ValueError( f"failed to fetch requested key {key_id}: got {actor['publicKey']}"