in config/reference_config.go [86:131]
func (rc *ReferenceConfig) Init(root *RootConfig) error {
for _, method := range rc.Methods {
if err := method.Init(); err != nil {
return err
}
}
if err := defaults.Set(rc); err != nil {
return err
}
rc.rootConfig = root
if root.Application != nil {
rc.metaDataType = root.Application.MetadataType
if rc.Group == "" {
rc.Group = root.Application.Group
}
if rc.Version == "" {
rc.Version = root.Application.Version
}
}
rc.RegistryIDs = translateIds(rc.RegistryIDs)
if root.Consumer != nil {
if rc.Filter == "" {
rc.Filter = root.Consumer.Filter
}
if len(rc.RegistryIDs) <= 0 {
rc.RegistryIDs = root.Consumer.RegistryIDs
}
if rc.Protocol == "" {
rc.Protocol = root.Consumer.Protocol
}
if rc.TracingKey == "" {
rc.TracingKey = root.Consumer.TracingKey
}
if rc.Check == nil {
rc.Check = &root.Consumer.Check
}
}
if rc.Cluster == "" {
rc.Cluster = "failover"
}
if root.Metrics.Enable != nil {
rc.metricsEnable = *root.Metrics.Enable
}
return verify(rc)
}