Skip to content

Commit

Permalink
feat: add username and password to es client
Browse files Browse the repository at this point in the history
  • Loading branch information
kavzovic committed Aug 8, 2024
1 parent c4d9830 commit 07765c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
)

type Elasticsearch struct {
Username string `yaml:"username"`
Password string `yaml:"password"`
BatchByteSizeLimit any `yaml:"batchByteSizeLimit"`
CollectionIndexMapping map[string]string `yaml:"collectionIndexMapping"`
MaxConnsPerHost *int `yaml:"maxConnsPerHost"`
Expand Down
2 changes: 2 additions & 0 deletions elasticsearch/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (

func NewElasticClient(config *config.Config) (*elasticsearch.Client, error) {
es, err := elasticsearch.NewClient(elasticsearch.Config{
Username: config.Elasticsearch.Username,
Password: config.Elasticsearch.Password,
MaxRetries: math.MaxInt,
Addresses: config.Elasticsearch.Urls,
Transport: newTransport(config.Elasticsearch),
Expand Down

0 comments on commit 07765c0

Please sign in to comment.