Skip to content

Commit

Permalink
fix: some style bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenceLiZhixin committed Jan 27, 2021
1 parent 042a53f commit 8354e91
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion config/config_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewDefaultRegistryConfig(protocol string) *RegistryConfig {
type RegistryConfigOpt func(config *RegistryConfig) *RegistryConfig

func NewRegistryConfig(opts ...RegistryConfigOpt) *RegistryConfig {
newRegistryConfig := NewDefaultRegistryConfig("none")
newRegistryConfig := NewDefaultRegistryConfig("")
for _, v := range opts {
newRegistryConfig = v(newRegistryConfig)
}
Expand Down Expand Up @@ -168,6 +168,7 @@ func NewConsumerConfig(opts ...ConsumerConfigOpt) *ConsumerConfig {
}
return newConfig
}

func WithConsumerAppConfig(appConfig *ApplicationConfig) ConsumerConfigOpt {
return func(config *ConsumerConfig) *ConsumerConfig {
config.ApplicationConfig = appConfig
Expand Down Expand Up @@ -241,24 +242,28 @@ func WithReferenceRegistry(registry string) ReferenceConfigOpt {
return config
}
}

func WithReferenceProtocol(protocol string) ReferenceConfigOpt {
return func(config *ReferenceConfig) *ReferenceConfig {
config.Protocol = protocol
return config
}
}

func WithReferenceInterface(interfaceName string) ReferenceConfigOpt {
return func(config *ReferenceConfig) *ReferenceConfig {
config.InterfaceName = interfaceName
return config
}
}

func WithReferenceCluster(cluster string) ReferenceConfigOpt {
return func(config *ReferenceConfig) *ReferenceConfig {
config.Cluster = cluster
return config
}
}

func WithReferenceMethod(methodName, retries, lb string) ReferenceConfigOpt {
return func(config *ReferenceConfig) *ReferenceConfig {
config.Methods = append(config.Methods, &MethodConfig{
Expand Down Expand Up @@ -368,12 +373,14 @@ func WithServiceProtocol(protocol string) ServiceConfigOpt {
return config
}
}

func WithServiceInterface(interfaceName string) ServiceConfigOpt {
return func(config *ServiceConfig) *ServiceConfig {
config.InterfaceName = interfaceName
return config
}
}

func WithServiceLoadBalance(lb string) ServiceConfigOpt {
return func(config *ServiceConfig) *ServiceConfig {
config.Loadbalance = lb
Expand Down

0 comments on commit 8354e91

Please sign in to comment.