Files
autoClaude/config.py

38 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
配置加载器:从 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", [])
# --- 代理池 ---
# 代理逻辑统一由 proxy_pool.py 管理,这里只做 re-export 保持兼容
from proxy_pool import get_proxy, get_proxy_count # noqa: E402, F401