You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
package mcp
|
|
|
|
import (
|
|
"yunyan/modules"
|
|
|
|
"yunyan/lego/utils/mapstructure"
|
|
)
|
|
|
|
type (
|
|
Options struct {
|
|
modules.Options
|
|
Port int
|
|
Addr string
|
|
TLSCertFile string
|
|
TLSKeyFile string
|
|
Groups map[string][]string
|
|
// TokenKey 校验客户端 JWT 用,**必须与 gateway 的同一个值**
|
|
// (两边都从 .env 的 GATEWAY_TOKEN_KEY 注入)。
|
|
// 留空时所有用户数据类工具一律拒绝服务 —— 配置漏了导致鉴权静默失效
|
|
// 比工具不可用严重得多。
|
|
TokenKey string
|
|
// McpTokenKey 校验 user_getmcptoken 签发的 MCP 令牌用,
|
|
// **必须与 user 模块的同名配置一致**。它与 TokenKey 是两把不同的钥匙:
|
|
// MCP 令牌要经过百炼(第三方)之手,不能用能开全站的那把去签。
|
|
McpTokenKey string
|
|
}
|
|
)
|
|
|
|
func (this *Options) LoadConfig(settings map[string]interface{}) (err error) {
|
|
if settings != nil {
|
|
if err = this.Options.LoadConfig(settings); err != nil {
|
|
return
|
|
}
|
|
if err = mapstructure.Decode(settings, this); err != nil {
|
|
return
|
|
}
|
|
}
|
|
return
|
|
}
|
|
|