Documentation ¶
Overview ¶
Package config @Title title @Description desc @Author yr 2024/11/28 @Update yr 2024/11/28
Index ¶
- Constants
- Variables
- func GetDiscoveryConf(name string) interface{}
- func GetServiceConf(serviceName string) interface{}
- func GetStatus() string
- func Init(confPath string)
- func IsDebug() bool
- func RegisterDiscoveryConf(name string, conf interface{})
- func RegisterServiceConf(cfgs ...*ServiceConfig)
- func SetStatus(status string)
- type ClusterConf
- type ETCDConf
- type EtcdDiscoveryConf
- type NodeConf
- type RPCServer
- type ServiceConf
- type ServiceConfig
- type ServiceInitConf
Constants ¶
View Source
const ( Debug = `debug` Release = `release` )
Variables ¶
View Source
var (
Conf = new(conf)
)
Functions ¶
func GetDiscoveryConf ¶
func GetDiscoveryConf(name string) interface{}
func GetServiceConf ¶
func GetServiceConf(serviceName string) interface{}
func RegisterDiscoveryConf ¶
func RegisterDiscoveryConf(name string, conf interface{})
func RegisterServiceConf ¶
func RegisterServiceConf(cfgs ...*ServiceConfig)
Types ¶
type ClusterConf ¶
type ClusterConf struct { ETCDConf *ETCDConf `binding:"required"` // etcd配置 RPCServer *RPCServer `binding:""` // rpc服务配置 RemoteType string `binding:""` // 远程服务类型(默认rpcx) DiscoveryType string `binding:""` // 服务发现类型(默认etcd) RemoteConfPath string `binding:""` // 远程配置路径(开启了远程配置才会使用,且必须配置etcd) DiscoveryConf *EtcdDiscoveryConf `binding:""` // 服务发现配置(目前先直接配置,后续会支持多种服务发现方式) }
type EtcdDiscoveryConf ¶
type NodeConf ¶
type NodeConf struct { NodeId string `binding:""` // 节点ID(目前这个没用,节点id是节点启动的时候自动生成的) SystemStatus string `binding:"required"` // 系统状态(debug/release) PVCPath string `binding:"required"` // 数据持久化目录(默认./data) PVPath string `binding:"required"` // 缓存目录(默认./run) ProfilerInterval time.Duration `binding:""` // 性能分析间隔(默认0,不开启) AntsPoolSize int `binding:"required"` // 线程池大小 }
type ServiceConf ¶
type ServiceConf struct { OpenRemote bool `binding:""` // 是否开启远程配置(默认使用本地) RemoteConfPath string `binding:""` // 远程配置路径(开启了远程配置才会使用,且必须配置etcd) StartServices []*ServiceInitConf `binding:"required"` // 启动服务列表(按照配置的顺序启动!!) ServicesConfMap map[string]*ServiceConfig `binding:"required"` // 服务配置 }
type ServiceConfig ¶
Click to show internal directories.
Click to hide internal directories.