diff --git a/config/config_loader.go b/config/config_loader.go index d5f8c68c1bf35c40c09d7d15bae4b6b9f161e9e7..8b196305b9cf7d33cb149def149af178f0e2808c 100644 --- a/config/config_loader.go +++ b/config/config_loader.go @@ -42,6 +42,7 @@ var ( providerConfig *ProviderConfig // baseConfig = providerConfig.BaseConfig or consumerConfig baseConfig *BaseConfig + sslEnabled = false // configAccessMutex is used to make sure that xxxxConfig will only be created once if needed. // it should be used combine with double-check to avoid the race condition @@ -325,6 +326,12 @@ func GetBaseConfig() *BaseConfig { return baseConfig } +func GetSslEnabled() bool { + return sslEnabled +} +func SetSslEnabled(enabled bool) { + sslEnabled = enabled +} func IsProvider() bool { return providerConfig != nil } diff --git a/config/protocol_config.go b/config/protocol_config.go index 3d9e1185d6364ccc8ca4a6c6f0b6f9a895467a94..cee5b7aa7518ff55a15d05de4733cefbbc9c0a1c 100644 --- a/config/protocol_config.go +++ b/config/protocol_config.go @@ -27,10 +27,9 @@ import ( // ProtocolConfig is protocol configuration type ProtocolConfig struct { - Name string `required:"true" yaml:"name" json:"name,omitempty" property:"name"` - Ip string `required:"true" yaml:"ip" json:"ip,omitempty" property:"ip"` - Port string `required:"true" yaml:"port" json:"port,omitempty" property:"port"` - SslEnabled bool `required:"false" yaml:"sslEnabled" json:"sslEnabled,omitempty" property:"sslEnabled"` + Name string `required:"true" yaml:"name" json:"name,omitempty" property:"name"` + Ip string `required:"true" yaml:"ip" json:"ip,omitempty" property:"ip"` + Port string `required:"true" yaml:"port" json:"port,omitempty" property:"port"` } // nolint diff --git a/config/service_config.go b/config/service_config.go index 728915381a8b13442914a934e9e3bf4cfc89e27f..54383e4791bf0d0749aea08d7ba9a613e4cfe70b 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -188,7 +188,7 @@ func (c *ServiceConfig) Export() error { common.WithPort(port), common.WithParams(urlMap), common.WithParamsValue(constant.BEAN_NAME_KEY, c.id), - common.WithParamsValue(constant.SSL_ENABLED_KEY, strconv.FormatBool(proto.SslEnabled)), + common.WithParamsValue(constant.SSL_ENABLED_KEY, strconv.FormatBool(GetSslEnabled())), common.WithMethods(strings.Split(methods, ",")), common.WithToken(c.Token), )