34 lines
707 B
Go
34 lines
707 B
Go
package config
|
|
|
|
import (
|
|
"github.com/zeromicro/go-zero/rest"
|
|
"github.com/zeromicro/go-zero/zrpc"
|
|
)
|
|
|
|
type Config struct {
|
|
rest.RestConf
|
|
|
|
Cors struct {
|
|
Enable bool
|
|
AllowOrigins []string
|
|
AllowMethods []string
|
|
AllowHeaders []string
|
|
}
|
|
|
|
Upstreams []Upstream
|
|
|
|
// system-rpc 连接(用于写入操作日志)
|
|
SystemRpc zrpc.RpcClientConf
|
|
|
|
// JWT 密钥(用于解析 Token 获取 userId,与 user-api 的 Auth.AccessSecret 保持一致)
|
|
JwtSecret string `json:",optional"`
|
|
|
|
// 无需鉴权的路径白名单
|
|
AuthWhitelist []string `json:",optional"`
|
|
}
|
|
|
|
type Upstream struct {
|
|
Prefix string // URL 前缀,如 /api/user
|
|
Target string // 后端地址,如 http://127.0.0.1:9001
|
|
}
|