This is an automated email from the ASF dual-hosted git repository.

tianxiaoliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-kie.git


The following commit(s) were added to refs/heads/master by this push:
     new acaa1c5  Fix: log print without error message and DB TLS config not 
work (#200)
acaa1c5 is described below

commit acaa1c57df156aca05b616e88931e3a1cfe4efc0
Author: little-cui <[email protected]>
AuthorDate: Thu Aug 12 20:29:03 2021 +0800

    Fix: log print without error message and DB TLS config not work (#200)
    
    * Fix: log print without error message
    
    * Fix: TLS config not work
    
    Co-authored-by: SphaIris <aaalixiaopei123>
---
 examples/dev/kie-conf.yaml | 19 ++++++++++---------
 go.mod                     |  2 +-
 go.sum                     |  4 ++++
 server/config/struct.go    | 17 ++++++++++-------
 server/datasource/dao.go   | 13 ++++++++-----
 5 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/examples/dev/kie-conf.yaml b/examples/dev/kie-conf.yaml
index 7f57ab2..0607d72 100644
--- a/examples/dev/kie-conf.yaml
+++ b/examples/dev/kie-conf.yaml
@@ -1,17 +1,18 @@
 db:
+  # kind can be mongo, etcd, embedded_etcd
+  kind: mongo
+  # uri is the db endpoints list
+  #   kind=mongo, then is the mongodb cluster's uri, e.g. 
mongodb://127.0.0.1:27017/kie
+  #   kind=etcd, then is the  remote etcd server's advertise-client-urls, e.g. 
http://127.0.0.1:2379
+  #   kind=embedded_etcd, then is the embedded etcd server's 
advertise-peer-urls, e.g. default=http://127.0.0.1:2380
   uri: mongodb://kie:[email protected]:27017/kie
-  kind: mongodb
-  #uri: 127.0.0.1:2379
-  #kind: etcd
-  #uri: default=http://127.0.0.1:2380
-  #kind: embedded_etcd
   poolSize: 10
   timeout: 5m
   sslEnabled: false
-  rootCAFile: /opt/kie/ca.crt
-  certFile: /opt/kie/server.cer
-  keyFile: /opt/kie/server_key.pem
-  certPwdFile: /opt/kie/cert_pwd
+  rootCAFile: ./ssl/trust.cer
+  certFile: ./ssl/server.cer
+  keyFile: ./ssl/server_key.pem
+  certPwdFile: ./ssl/cert_pwd
 rbac:
   enabled: false
   rsaPublicKeyFile: ./examples/dev/public.key
\ No newline at end of file
diff --git a/go.mod b/go.mod
index 6a9b868..5ad76db 100644
--- a/go.mod
+++ b/go.mod
@@ -10,7 +10,7 @@ require (
        github.com/go-chassis/openlog v1.1.3
        github.com/go-chassis/seclog v1.3.0
        github.com/hashicorp/serf v0.9.5
-       github.com/little-cui/etcdadpt v0.1.0
+       github.com/little-cui/etcdadpt v0.1.1
        github.com/satori/go.uuid v1.2.0
        github.com/stretchr/testify v1.7.0
        github.com/urfave/cli v1.22.4
diff --git a/go.sum b/go.sum
index 96a03cc..e5e5a58 100644
--- a/go.sum
+++ b/go.sum
@@ -497,6 +497,10 @@ github.com/little-cui/etcdadpt 
v0.0.0-20210810075513-c1b3b553bd16 h1:81fTtq/xBcM
 github.com/little-cui/etcdadpt v0.0.0-20210810075513-c1b3b553bd16/go.mod 
h1:gxgrmwRiKs5w5qKEt2d3QOpdrHACnBORzreniLoH0S0=
 github.com/little-cui/etcdadpt v0.1.0 
h1:yfVTl04zUE2SFN+3xbBRnFgmXOeIxAqc10IDBwO20FY=
 github.com/little-cui/etcdadpt v0.1.0/go.mod 
h1:gxgrmwRiKs5w5qKEt2d3QOpdrHACnBORzreniLoH0S0=
+github.com/little-cui/etcdadpt v0.1.1-0.20210812074633-41cdf7ebed00 
h1:TwCL17fRBqzrelj5Ea+QW0u6T0JFieLduquAsRG6UX8=
+github.com/little-cui/etcdadpt v0.1.1-0.20210812074633-41cdf7ebed00/go.mod 
h1:gxgrmwRiKs5w5qKEt2d3QOpdrHACnBORzreniLoH0S0=
+github.com/little-cui/etcdadpt v0.1.1 
h1:Y5y838f2Sud/mZMrHK/BWyj8a+GrzIHXX4ECuM9DlCY=
+github.com/little-cui/etcdadpt v0.1.1/go.mod 
h1:gxgrmwRiKs5w5qKEt2d3QOpdrHACnBORzreniLoH0S0=
 github.com/lyft/protoc-gen-validate v0.0.13/go.mod 
h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
 github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a 
h1:TpvdAwDAt1K4ANVOfcihouRdvP+MgAfDWwBuct4l6ZY=
 github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod 
h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
diff --git a/server/config/struct.go b/server/config/struct.go
index 1a0a05d..357a84b 100644
--- a/server/config/struct.go
+++ b/server/config/struct.go
@@ -31,13 +31,16 @@ type Config struct {
 
 //DB is yaml file struct to set persistent config
 type DB struct {
-       URI        string `yaml:"uri"`
-       Kind       string `yaml:"kind"`
-       PoolSize   int    `yaml:"poolSize"`
-       SSLEnabled bool   `yaml:"sslEnabled"`
-       RootCA     string `yaml:"rootCAFile"`
-       Timeout    string `yaml:"timeout"`
-       VerifyPeer bool   `yaml:"verifyPeer"`
+       URI         string `yaml:"uri"`
+       Kind        string `yaml:"kind"`
+       PoolSize    int    `yaml:"poolSize"`
+       SSLEnabled  bool   `yaml:"sslEnabled"`
+       RootCA      string `yaml:"rootCAFile"`
+       CertFile    string `yaml:"certFile"`
+       KeyFile     string `yaml:"keyFile"`
+       CertPwdFile string `yaml:"certPwdFile"`
+       Timeout     string `yaml:"timeout"`
+       VerifyPeer  bool   `yaml:"verifyPeer"`
 }
 
 //RBAC is rbac config
diff --git a/server/datasource/dao.go b/server/datasource/dao.go
index bb91425..b181100 100644
--- a/server/datasource/dao.go
+++ b/server/datasource/dao.go
@@ -135,11 +135,14 @@ func Init(c config.DB) error {
                timeout = DefaultTimeout
        }
        dbc := &Config{
-               URI:        c.URI,
-               PoolSize:   c.PoolSize,
-               SSLEnabled: c.SSLEnabled,
-               RootCA:     c.RootCA,
-               Timeout:    timeout,
+               URI:         c.URI,
+               PoolSize:    c.PoolSize,
+               SSLEnabled:  c.SSLEnabled,
+               RootCA:      c.RootCA,
+               CertFile:    c.CertFile,
+               CertPwdFile: c.CertPwdFile,
+               KeyFile:     c.KeyFile,
+               Timeout:     timeout,
        }
        if b, err = f(dbc); err != nil {
                return err

Reply via email to