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.
40 lines
1.1 KiB
40 lines
1.1 KiB
package user
|
|
|
|
import (
|
|
"yunyan/modules"
|
|
|
|
"yunyan/lego/utils/mapstructure"
|
|
)
|
|
|
|
type (
|
|
IOptions interface {
|
|
modules.IOptions
|
|
}
|
|
Options struct {
|
|
modules.Options
|
|
TokenKey string
|
|
// McpTokenKey 签发 MCP 访问令牌用,**必须与 mcp 服务的同名配置一致**。
|
|
// ⚠️ 刻意不复用 TokenKey:同一把密钥签出来的令牌 gateway 也会认,
|
|
// 那 MCP 令牌「只能用于 MCP」这个限制就形同虚设了。留空时
|
|
// user_getmcptoken 直接报错,不会退化成用 TokenKey 签。
|
|
McpTokenKey string
|
|
CBCKey string
|
|
AvatarUrl string //头像地址
|
|
UserGroup int //用户分组
|
|
OpenTestAccount bool //是否开启测试账号
|
|
TestAccounts []string //是否测试账号
|
|
TestAccountPassword 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
|
|
}
|
|
|