feat: Phase 4 多平台接入 — Platform Bridge + 6平台适配器 + 身份权限系统 (22文件, 2129行)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-23 16:19:57 +08:00
parent 717ad65b05
commit 965cce7192
22 changed files with 2129 additions and 2 deletions
@@ -0,0 +1,52 @@
package config
import "os"
// Config holds Platform Bridge configuration.
type Config struct {
Port string
Env string
GatewayURL string
AICoreURL string
InternalToken string
// Platform-specific.
QQBotPort string // port for QQ OBv11 reverse WebSocket
TelegramToken string // Telegram Bot API token
TelegramWebhookURL string // public webhook URL for Telegram
}
func Load() *Config {
cfg := &Config{
Port: "8095",
Env: "development",
GatewayURL: "http://localhost:8080",
AICoreURL: "http://localhost:8081",
QQBotPort: "8096",
}
if v := os.Getenv("PORT"); v != "" {
cfg.Port = v
}
if v := os.Getenv("ENV"); v != "" {
cfg.Env = v
}
if v := os.Getenv("GATEWAY_URL"); v != "" {
cfg.GatewayURL = v
}
if v := os.Getenv("AI_CORE_URL"); v != "" {
cfg.AICoreURL = v
}
if v := os.Getenv("INTERNAL_SERVICE_TOKEN"); v != "" {
cfg.InternalToken = v
}
if v := os.Getenv("QQ_BOT_PORT"); v != "" {
cfg.QQBotPort = v
}
if v := os.Getenv("TELEGRAM_BOT_TOKEN"); v != "" {
cfg.TelegramToken = v
}
if v := os.Getenv("TELEGRAM_WEBHOOK_URL"); v != "" {
cfg.TelegramWebhookURL = v
}
return cfg
}