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.
28 lines
657 B
28 lines
657 B
package migu
|
|
|
|
import (
|
|
"yunyan/modules"
|
|
|
|
"yunyan/lego/utils/mapstructure"
|
|
)
|
|
|
|
type (
|
|
Options struct {
|
|
modules.Options
|
|
Port int // HTTP 监听端口(独立部署,不走 gateway;TLS 由外层 nginx 处理)
|
|
Addr string // 对外可访问地址,仅记录/日志用
|
|
ApiKey string // 入站鉴权 key,非空时校验 Authorization: Bearer <key>,为空则不校验
|
|
}
|
|
)
|
|
|
|
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
|
|
}
|
|
|