Skip to content

Commit

Permalink
feat: print es config
Browse files Browse the repository at this point in the history
  • Loading branch information
erayarslan committed Sep 5, 2024
1 parent 155e353 commit 6c32d31
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,11 +1,15 @@
package dcpelasticsearch

import (
"bytes"
"encoding/json"
"errors"
"os"
"regexp"
"strings"

jsoniter "github.com/json-iterator/go"

dcpCouchbase "github.com/Trendyol/go-dcp/couchbase"

"github.com/Trendyol/go-dcp-elasticsearch/elasticsearch/client"
Expand Down Expand Up @@ -163,6 +167,9 @@ func newConnector(cf any, mapper Mapper, sinkResponseHandler dcpElasticsearch.Si
return nil, err
}

copyOfConfig := cfg.Elasticsearch
printConfiguration(copyOfConfig)

dcpConfig := dcp.GetConfig()
dcpConfig.Checkpoint.Type = "manual"

Expand Down Expand Up @@ -227,3 +234,16 @@ func (c *ConnectorBuilder) SetSinkResponseHandler(sinkResponseHandler dcpElastic
c.sinkResponseHandler = sinkResponseHandler
return c
}

func printConfiguration(config config.Elasticsearch) {
config.Password = "*****"
configJSON, _ := jsoniter.Marshal(config)

dst := &bytes.Buffer{}
if err := json.Compact(dst, configJSON); err != nil {
logger.Log.Error("error while print elasticsearch configuration, err: %v", err)
panic(err)
}

logger.Log.Info("using elasticsearch config: %v", dst.String())
}

0 comments on commit 6c32d31

Please sign in to comment.