api配置

    rest.RestConf

    1. service.ServiceConf // service配置
    2. Host string `json:",default=0.0.0.0"` // http监听ip,默认0.0.0.0
    3. Port int // http监听端口,必填
    4. CertFile string `json:",optional"` // https证书文件,可选
    5. KeyFile string `json:",optional"` // https私钥文件,可选
    6. Verbose bool `json:",optional"` // 是否打印详细http请求日志
    7. MaxBytes int64 `json:",default=1048576,range=[0:8388608]"` // http可接受请求的最大ContentLength,默认1048576,被设置值不能必须在0到8388608之间
    8. // milliseconds
    9. Timeout int64 `json:",default=3000"` // 超时时长控制,单位:毫秒,默认3000
    10. Signature SignatureConf `json:",optional"` // 签名配置

    service.ServiceConf

    1. type ServiceConf struct {
    2. Name string // 服务名称
    3. Log logx.LogConf // 日志配置
    4. Mode string `json:",default=pro,options=dev|test|pre|pro"` // 服务环境,dev-开发环境,test-测试环境,pre-预发环境,pro-正式环境
    5. MetricsUrl string `json:",optional"` // 指标上报接口地址,该地址需要支持post json即可
    6. Prometheus prometheus.Config `json:",optional"` // prometheus配置
    7. }

    prometheus.Config

    1. type Config struct {
    2. Host string `json:",optional"` // prometheus 监听host
    3. Port int `json:",default=9101"` // prometheus 监听端口
    4. Path string `json:",default=/metrics"` // 上报地址

    SignatureConf

    1. SignatureConf struct {
    2. Expiry time.Duration `json:",default=1h"` // 有效期,默认1小时
    3. PrivateKeys []PrivateKeyConf // 签名密钥相关配置
    4. }

    cache.CacheConf

    1. ClusterConf []NodeConf
    2. NodeConf struct {
    3. redis.RedisConf
    4. Weight int `json:",default=100"` // 权重
    5. }

    redis.RedisConf

    1. RedisConf struct {
    2. Host string // redis地址
    3. Type string `json:",default=node,options=node|cluster"` // redis类型
    4. Pass string `json:",optional"` // redis密码
    5. }