cjphaha commented on a change in pull request #68:
URL: https://github.com/apache/dubbo-go-samples/pull/68#discussion_r600692917



##########
File path: tls/go-server/cmd/server.go
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package main
+
+import (
+       "fmt"
+       "os"
+       "os/signal"
+       "path/filepath"
+       "syscall"
+       "time"
+)
+
+import (
+       getty "github.com/apache/dubbo-getty"
+       "github.com/apache/dubbo-go-samples/tls/go-server/pkg"
+       hessian "github.com/apache/dubbo-go-hessian2"
+)
+
+import (
+       "github.com/apache/dubbo-go/common/logger"
+       "github.com/apache/dubbo-go/config"
+       _ "github.com/apache/dubbo-go/protocol/dubbo"
+       _ "github.com/apache/dubbo-go/registry/protocol"
+       _ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
+       _ "github.com/apache/dubbo-go/filter/filter_impl"
+       _ "github.com/apache/dubbo-go/cluster/cluster_impl"
+       _ "github.com/apache/dubbo-go/cluster/loadbalance"
+       _ "github.com/apache/dubbo-go/registry/zookeeper"
+)
+
+// 生存时间
+var (
+       survivalTimeout =       int(3e9)
+)
+
+func init(){
+       serverPemPath, _ := filepath.Abs("../certs/server.pem")
+       serverKeyPath, _ := filepath.Abs("../certs/server.key")
+       caPemPath, _ := filepath.Abs("../certs/ca.pem")
+       config.SetSslEnabled(true)
+       config.SetServerTlsConfigBuilder(&getty.ServerTlsConfigBuilder{
+               ServerKeyCertChainPath:        serverPemPath,
+               ServerPrivateKeyPath:          serverKeyPath,
+               ServerTrustCertCollectionPath: caPemPath,
+       })
+}
+
+/*
+       需要配置环境变量
+       export CONF_PROVIDER_FILE_PATH="xx"
+       export APP_LOG_CONF_FILE="xx"
+ */
+
+func main() {
+       // 在运行的时候序列化
+       hessian.RegisterPOJO(&pkg.User{})
+       // 加载配置
+       config.Load()
+       // 优雅的结束程序
+       initSignal()
+}
+
+// 优雅的结束程序

Review comment:
       I have modified the problems in PR, thank you very much!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to