From 67abe6b5cae30f0f65539fb3fcf45df95c2a5ebc Mon Sep 17 00:00:00 2001
From: aliiohs <renzhiyuan@wecash.net>
Date: Tue, 11 Aug 2020 01:29:32 +0800
Subject: [PATCH] fix

---
 config/config_loader.go   | 7 +++++++
 config/protocol_config.go | 7 +++----
 config/service_config.go  | 2 +-
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/config/config_loader.go b/config/config_loader.go
index d5f8c68c1..8b196305b 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 3d9e1185d..cee5b7aa7 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 728915381..54383e479 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),
 		)
-- 
GitLab