chore: refactor logging module, update genesis timestamp, remove model relationships, and reorganize routers - Rename logging.py to logger.py and update import paths in poa.py and main.py - Update devnet genesis timestamp to 1766828620 - Remove SQLModel Relationship declarations from Block, Transaction, and Receipt models - Add SessionDep type alias and get_session dependency in coordinator-api deps - Reorganize coordinator-api routers: replace explorer/registry with exchange, users, marketplace
31 lines
788 B
Python
31 lines
788 B
Python
from __future__ import annotations
|
|
|
|
from functools import lru_cache
|
|
|
|
from fastapi import Depends
|
|
|
|
from .keystore.service import KeystoreService
|
|
from .ledger_mock import SQLiteLedgerAdapter
|
|
from .receipts.service import ReceiptVerifierService
|
|
from .settings import Settings, settings
|
|
|
|
|
|
def get_settings() -> Settings:
|
|
return settings
|
|
|
|
|
|
def get_receipt_service(config: Settings = Depends(get_settings)) -> ReceiptVerifierService:
|
|
return ReceiptVerifierService(
|
|
coordinator_url=config.coordinator_base_url,
|
|
api_key=config.coordinator_api_key,
|
|
)
|
|
|
|
|
|
@lru_cache
|
|
def get_keystore() -> KeystoreService:
|
|
return KeystoreService()
|
|
|
|
|
|
def get_ledger(config: Settings = Depends(get_settings)) -> SQLiteLedgerAdapter:
|
|
return SQLiteLedgerAdapter(config.ledger_db_path)
|