package config import ( "reflect" cdr "git.loafle.net/commons/di-go/registry" "git.loafle.net/commons/logging-go" cur "git.loafle.net/commons/util-go/reflect" occp "git.loafle.net/overflow/commons-go/config/probe" ) const ( ConfigKey = "Config" Dev = true ) var ( ProbePortNumber int64 ) type Config struct { Account *occp.Account `required:"true" json:"account" yaml:"account" toml:"account"` Central *occp.Central `required:"true" json:"central" yaml:"central" toml:"central"` Probe *occp.Probe `required:"true" json:"probe" yaml:"probe" toml:"probe"` } func GetConfig() *Config { _config, err := cdr.GetInstanceByName(ConfigKey) if nil != err { logging.Logger().Error(err) return nil } config, ok := _config.(*Config) if !ok { _, pkg, n := cur.GetTypeInfo(reflect.TypeOf(_config)) logging.Logger().Errorf("Cannot convert [%s]%s to Config type", pkg, n) return nil } return config }