Skip to content

Commit

Permalink
skip the tls verify
Browse files Browse the repository at this point in the history
  • Loading branch information
andy committed Aug 15, 2024
1 parent 7177cda commit 74f8122
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/es/es5.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"context"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/CharellKing/ela/config"
Expand All @@ -12,6 +13,7 @@ import (
"github.com/spf13/cast"
"io"
"log"
"net/http"
"strings"
"time"

Expand All @@ -27,10 +29,17 @@ type V5 struct {
}

func NewESV5(esConfig *config.ESConfig, clusterVersion string) (*V5, error) {
transport := &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
}

client, err := elasticsearch5.NewClient(elasticsearch5.Config{
Addresses: esConfig.Addresses,
Username: esConfig.User,
Password: esConfig.Password,
Transport: transport,
})
if err != nil {
return nil, errors.WithStack(err)
Expand Down
10 changes: 10 additions & 0 deletions pkg/es/es6.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"context"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/CharellKing/ela/config"
Expand All @@ -12,6 +13,7 @@ import (
"github.com/spf13/cast"
"io"
"log"
"net/http"
"strings"
"time"

Expand All @@ -27,11 +29,19 @@ type V6 struct {
}

func NewESV6(esConfig *config.ESConfig, clusterVersion string) (*V6, error) {
transport := &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
}

client, err := elasticsearch6.NewClient(elasticsearch6.Config{
Addresses: esConfig.Addresses,
Username: esConfig.User,
Password: esConfig.Password,
Transport: transport,
})

if err != nil {
return nil, errors.WithStack(err)
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/es/es7.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"context"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/CharellKing/ela/config"
Expand All @@ -12,6 +13,7 @@ import (
"github.com/spf13/cast"
"io"
"log"
"net/http"
"strings"
"time"

Expand All @@ -27,11 +29,19 @@ type V7 struct {
}

func NewESV7(esConfig *config.ESConfig, clusterVersion string) (*V7, error) {
transport := &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
}

client, err := elasticsearch7.NewClient(elasticsearch7.Config{
Addresses: esConfig.Addresses,
Username: esConfig.User,
Password: esConfig.Password,
Transport: transport,
})

if err != nil {
return nil, errors.WithStack(err)
}
Expand Down
10 changes: 10 additions & 0 deletions pkg/es/es8.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"bytes"
"context"
"crypto/tls"
"encoding/json"
"fmt"
"github.com/CharellKing/ela/config"
Expand All @@ -12,6 +13,7 @@ import (
"github.com/spf13/cast"
"io"
"log"
"net/http"
"strings"
"time"

Expand All @@ -27,11 +29,19 @@ type V8 struct {
}

func NewESV8(esConfig *config.ESConfig, clusterVersion string) (*V8, error) {
transport := &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
},
}

client, err := elasticsearch8.NewClient(elasticsearch8.Config{
Addresses: esConfig.Addresses,
Username: esConfig.User,
Password: esConfig.Password,
Transport: transport,
})

if err != nil {
return nil, errors.WithStack(err)
}
Expand Down

0 comments on commit 74f8122

Please sign in to comment.