Skip to content

Commit

Permalink
feat: print target couchbase config
Browse files Browse the repository at this point in the history
  • Loading branch information
erayarslan committed Sep 5, 2024
1 parent 85b7df0 commit 4c6921f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions connector.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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())
}

0 comments on commit 4c6921f

Please sign in to comment.