123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package options
- import (
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/database/myredis"
- "sync"
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/app/server"
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/database/myorm"
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/log"
- "gogs.baozhida.cn/Cold_Logistic_libs/pkg/contrib/objectStore"
- )
- type Options struct {
- Log *log.Options `json:"log"`
- Server *server.SeverOption `json:"server" mapstructure:"server"`
- DB *myorm.DBOption `json:"database" mapstructure:"database"`
- IpWhiteList []string `json:"ipWhiteList" mapstructure:"ipWhiteList"`
- Storage *objectStore.Options `json:"storage" mapstructure:"storage"`
- Nats *NatsOption `json:"nats" `
- BzdClod *BzdOption `json:"bzdClod" mapstructure:"bzdClod"`
- Wechat *WechatOption `json:"wechat" mapstructure:"wechat"`
- Redis *myredis.RedisOption `json:"redis"`
- }
- var (
- once sync.Once
- OptInstance *Options
- )
- func NewOptions() *Options {
- once.Do(func() {
- o := Options{
- Log: log.NewOptions(),
- }
- OptInstance = &o
- })
- return OptInstance
- }
- // Validate 统一验证...
- func (o *Options) Validate() []error {
- var errs []error
- errs = append(errs, o.Log.Validate()...)
- return errs
- }
|