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.
35 lines
804 B
35 lines
804 B
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
|
|
}
|
|
)
|
|
|
|
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
|
|
}
|
|
|