""" 配置加载器:从 config.toml 读取配置,对外暴露与原 config.py 相同的变量名。 """ import sys import tomllib from pathlib import Path # --- 加载 TOML --- _config_path = Path(__file__).parent / "config.toml" if not _config_path.exists(): print("❌ 找不到 config.toml!") print(" 请复制 config.toml.example 为 config.toml 并填入实际值:") print(" copy config.toml.example config.toml") sys.exit(1) with open(_config_path, "rb") as f: _cfg = tomllib.load(f) # --- Claude --- CLAUDE_URL: str = _cfg["claude"]["url"] # --- Stripe --- STRIPE_PK: str = _cfg["stripe"]["pk"] PRODUCT_ID: str = _cfg["stripe"]["product_id"] # --- Telegram Bot --- TG_BOT_TOKEN: str = _cfg["telegram"]["bot_token"] TG_ALLOWED_USERS: list[int] = _cfg["telegram"].get("allowed_users", []) # --- 邮箱系统 --- MAIL_SYSTEMS: list[dict] = _cfg.get("mail", [])