Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
SSHProxies map[string]SSHProxy `yaml:"ssh_proxies"`
Profiles map[string]Profile `yaml:"profiles"`
MCP MCPConfig `yaml:"mcp"`
}
File 表示 xsql.yaml 的配置结构。 约束:配置优先级为 CLI > ENV > Config。
type MCPConfig ¶ added in v0.0.6
type MCPConfig struct {
Transport string `yaml:"transport"` // stdio | streamable_http
HTTP MCPHTTPConfig `yaml:"http"`
}
MCPConfig 定义 MCP server 配置。
type MCPHTTPConfig ¶ added in v0.0.6
type MCPHTTPConfig struct {
Addr string `yaml:"addr"`
AuthToken string `yaml:"auth_token"` // 支持 keyring:xxx 引用
AllowPlaintextToken bool `yaml:"allow_plaintext_token"` // 允许明文 token
}
MCPHTTPConfig 定义 MCP Streamable HTTP 传输配置。
type Options ¶
type Options struct {
// ConfigPath: 若非空,则只读取该文件(不存在报错)。
ConfigPath string
// CLI
CLIProfile string
CLIProfileSet bool
CLIFormat string
CLIFormatSet bool
// ENV(由调用方注入,便于测试)
EnvProfile string
EnvFormat string
// HomeDir 用于默认路径计算(为空则自动探测)。
HomeDir string
// WorkDir 用于默认路径(为空则使用进程当前工作目录)。
WorkDir string
}
type Profile ¶
type Profile struct {
Description string `yaml:"description"` // 描述,用于区分不同数据库
Format string `yaml:"format"`
// DB 连接
DB string `yaml:"db"` // mysql | pg
DSN string `yaml:"dsn"` // 原生 DSN(优先)
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Password string `yaml:"password"` // 支持 keyring:xxx 引用
Database string `yaml:"database"`
// 安全选项
AllowPlaintext bool `yaml:"allow_plaintext"` // 允许明文密码
UnsafeAllowWrite bool `yaml:"unsafe_allow_write"` // 允许写操作(绕过只读保护)
// SSH proxy 引用(引用 ssh_proxies 中定义的名称)
SSHProxy string `yaml:"ssh_proxy"`
// 解析后的 SSH 配置(由 Resolve 填充,不从 YAML 读取)
SSHConfig *SSHProxy `yaml:"-"`
}
type Resolved ¶
type SSHProxy ¶
type SSHProxy struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
IdentityFile string `yaml:"identity_file"`
Passphrase string `yaml:"passphrase"` // 支持 keyring:xxx 引用
KnownHostsFile string `yaml:"known_hosts_file"`
SkipHostKey bool `yaml:"skip_host_key"` // 极不推荐
}
SSHProxy 定义可复用的 SSH 代理配置。
Click to show internal directories.
Click to hide internal directories.