Migrate exchange app to centralized aitbc package utilities

- Migrate 2 files from logging to aitbc.get_logger
- health_monitor.py, real_exchange_integration.py
- Remove logging.basicConfig() from both files
- Migrate 3 files with hardcoded paths to use DATA_DIR constant
- simple_exchange_api.py, scripts/seed_market.py, database.py
This commit is contained in:
aitbc
2026-04-25 07:12:27 +02:00
parent 10a0752732
commit a58773d4d4
5 changed files with 11 additions and 11 deletions

View File

@@ -9,12 +9,13 @@ from datetime import datetime
from http.server import HTTPServer, BaseHTTPRequestHandler
import urllib.parse
import random
from aitbc.constants import DATA_DIR
# Database setup
def get_db_path():
"""Get database path and ensure directory exists"""
import os
db_path = os.getenv("EXCHANGE_DATABASE_URL", "sqlite:////var/lib/aitbc/data/exchange/exchange.db").replace("sqlite:///", "")
db_path = os.getenv("EXCHANGE_DATABASE_URL", f"sqlite:///{DATA_DIR}/data/exchange/exchange.db").replace("sqlite://///", "")
# Create directory if it doesn't exist
db_dir = os.path.dirname(db_path)