feat: add runtime diagnostics and path management

This commit is contained in:
2026-04-15 16:55:45 +08:00
parent 7586685d5f
commit 6eefabb9ff
14 changed files with 304 additions and 85 deletions

View File

@@ -9,20 +9,17 @@ from pathlib import Path
import ccxt
from .logger import get_logs_last_n_hours, log_error
from .runtime import get_runtime_paths, load_env_file
ENV_FILE = Path.home() / ".hermes" / ".env"
REVIEW_DIR = Path.home() / ".coinhunter" / "reviews"
PATHS = get_runtime_paths()
ENV_FILE = PATHS.env_file
REVIEW_DIR = PATHS.reviews_dir
CST = timezone(timedelta(hours=8))
def load_env():
if ENV_FILE.exists():
for line in ENV_FILE.read_text(encoding="utf-8").splitlines():
line = line.strip()
if line and not line.startswith("#") and "=" in line:
key, val = line.split("=", 1)
os.environ.setdefault(key.strip(), val.strip())
load_env_file(PATHS)
def get_exchange():