From 4c6921faeef935822b9e1431657c20ad4ec0c9d7 Mon Sep 17 00:00:00 2001 From: Eray Arslan Date: Thu, 5 Sep 2024 14:21:40 +0300 Subject: [PATCH] feat: print target couchbase config --- connector.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/connector.go b/connector.go index d3c76ec..195c5e4 100644 --- a/connector.go +++ b/connector.go @@ -1,10 +1,14 @@ package dcpcouchbase import ( + "bytes" + "encoding/json" "errors" "os" "time" + jsoniter "github.com/json-iterator/go" + dcpCouchbase "github.com/Trendyol/go-dcp/couchbase" "github.com/Trendyol/go-dcp/helpers" @@ -145,6 +149,9 @@ func newConnector(cf any, mapper Mapper, sinkResponseHandler couchbase.SinkRespo return nil, err } + copyOfConfig := cfg.Couchbase + printConfiguration(copyOfConfig) + dcpConfig := dcp.GetConfig() dcpConfig.Checkpoint.Type = "manual" @@ -241,3 +248,16 @@ func (c *ConnectorBuilder) SetSinkResponseHandler(sinkResponseHandler couchbase. c.sinkResponseHandler = sinkResponseHandler return c } + +func printConfiguration(config config.Couchbase) { + config.Password = "*****" + configJSON, _ := jsoniter.Marshal(config) + + dst := &bytes.Buffer{} + if err := json.Compact(dst, configJSON); err != nil { + logger.Log.Error("error while print target couchbase configuration, err: %v", err) + panic(err) + } + + logger.Log.Info("using target couchbase config: %v", dst.String()) +}