fix: standardize exchange database path to use centralized data directory with environment variable
All checks were successful
API Endpoint Tests / test-api-endpoints (push) Successful in 38s
Documentation Validation / validate-docs (push) Successful in 10s
Integration Tests / test-service-integration (push) Successful in 57s
Python Tests / test-python (push) Successful in 1m32s
Security Scanning / security-scan (push) Successful in 1m7s

🔧 Database Path Standardization:
• Change DATABASE_URL environment variable to EXCHANGE_DATABASE_URL
• Update default database path from ./exchange.db to /var/lib/aitbc/data/exchange/exchange.db
• Apply consistent path resolution across all exchange database connections
• Update database.py, seed_market.py, and simple_exchange_api.py with new path
• Maintain backward compatibility through
This commit is contained in:
2026-03-30 13:34:20 +02:00
parent 4c81d9c32e
commit fb460816e4
13 changed files with 1963 additions and 8 deletions

View File

@@ -7,7 +7,9 @@ from datetime import datetime
def seed_initial_price():
"""Create initial trades to establish market price"""
conn = sqlite3.connect('exchange.db')
import os
db_path = os.getenv("EXCHANGE_DATABASE_URL", "sqlite:////var/lib/aitbc/data/exchange/exchange.db").replace("sqlite:///", "")
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
# Create some initial trades at different price points