package config import ( "cursor-api-proxy/pkg/infrastructure/env" "github.com/zeromicro/go-zero/rest" ) // Config for go-zero (generated by goctl) type Config struct { rest.RestConf // Cursor 配置 AgentBin string DefaultModel string Provider string TimeoutMs int // 多帳號池 ConfigDirs []string MultiPort bool // TLS TLSCertPath string TLSKeyPath string // 日誌 SessionsLogPath string Verbose bool // Gemini GeminiAccountDir string GeminiBrowserVisible bool GeminiMaxSessions int // 工作區 Workspace string ChatOnlyWorkspace bool WinCmdlineMax int // Agent Force bool ApproveMcps bool MaxMode bool StrictModel bool // API Key RequiredKey string } // BridgeConfig for backward compatibility with existing code type BridgeConfig struct { AgentBin string Host string Port int RequiredKey string DefaultModel string Mode string Provider string Force bool ApproveMcps bool StrictModel bool Workspace string TimeoutMs int TLSCertPath string TLSKeyPath string SessionsLogPath string ChatOnlyWorkspace bool Verbose bool MaxMode bool ConfigDirs []string MultiPort bool WinCmdlineMax int GeminiAccountDir string GeminiBrowserVisible bool GeminiMaxSessions int } // LoadBridgeConfig loads config from environment (for backward compatibility) func LoadBridgeConfig(e env.EnvSource, cwd string) BridgeConfig { loaded := env.LoadEnvConfig(e, cwd) return BridgeConfig{ AgentBin: loaded.AgentBin, Host: loaded.Host, Port: loaded.Port, RequiredKey: loaded.RequiredKey, DefaultModel: loaded.DefaultModel, Mode: "ask", Provider: loaded.Provider, Force: loaded.Force, ApproveMcps: loaded.ApproveMcps, StrictModel: loaded.StrictModel, Workspace: loaded.Workspace, TimeoutMs: loaded.TimeoutMs, TLSCertPath: loaded.TLSCertPath, TLSKeyPath: loaded.TLSKeyPath, SessionsLogPath: loaded.SessionsLogPath, ChatOnlyWorkspace: loaded.ChatOnlyWorkspace, Verbose: loaded.Verbose, MaxMode: loaded.MaxMode, ConfigDirs: loaded.ConfigDirs, MultiPort: loaded.MultiPort, WinCmdlineMax: loaded.WinCmdlineMax, GeminiAccountDir: loaded.GeminiAccountDir, GeminiBrowserVisible: loaded.GeminiBrowserVisible, GeminiMaxSessions: loaded.GeminiMaxSessions, } }