API configuration

    rest.RestConf

    1. service.ServiceConf // service configuration
    2. Host string `json:",default=0.0.0.0"` // http listening ip, default 0.0.0.0
    3. Port int // http listening port, required
    4. CertFile string `json:",optional"` // https certificate file, optional
    5. KeyFile string `json:",optional"` // https private key file, optional
    6. Verbose bool `json:",optional"` // whether to print detailed http request log
    7. MaxBytes int64 `json:",default=1048576,range=[0:8388608]"` // http can accept the maximum Content Length of the request, the default is 1048576, and the set value cannot be between 0 and 8388608
    8. // milliseconds
    9. Timeout int64 `json:",default=3000"` // timeout duration control, unit: milliseconds, default 3000
    10. Signature SignatureConf `json:",optional"` // signature configuration

    service.ServiceConf

    1. type ServiceConf struct {
    2. Name string // service name
    3. Log logx.LogConf // log configuration
    4. Mode string `json:",default=pro,options=dev|test|pre|pro"` // service environment, dev-development environment, test-test environment, pre-pre-release environment, pro-formal environment
    5. MetricsUrl string `json:",optional"` // index report interface address, this address needs to support post json
    6. Prometheus prometheus.Config `json:",optional"` // prometheus configuration
    7. }

    prometheus.Config

    1. type Config struct {
    2. Host string `json:",optional"` // prometheus monitor host
    3. Port int `json:",default=9101"` // prometheus listening port
    4. Path string `json:",default=/metrics"` // report address

    SignatureConf

    1. SignatureConf struct {
    2. Expiry time.Duration `json:",default=1h"` // Validity period, default is 1 hour
    3. PrivateKeys []PrivateKeyConf // Signing key related configuration
    4. }

    cache.CacheConf

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

    redis.RedisConf

    1. RedisConf struct {
    2. Host string // redis address
    3. Type string `json:",default=node,options=node|cluster"` // redis type
    4. Pass string `json:",optional"` // redis password
    5. }