Skip to content

Commit

Permalink
es add tls
Browse files Browse the repository at this point in the history
  • Loading branch information
PungYoung committed Apr 5, 2022
1 parent f0efecf commit a45b978
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions common/elasticsearch/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package elasticsearch

import (
"crypto/tls"
"net/http"
"net/url"
"os"
Expand All @@ -25,9 +26,10 @@ import (

// AWSSigningTransport used to sign outgoing requests to AWS ES
type AWSSigningTransport struct {
HTTPClient *http.Client
Credentials awsauth.Credentials
Session *session.Session
HTTPClient *http.Client
Credentials awsauth.Credentials
Session *session.Session
TLSClientConfig *tls.Config
}

// RoundTrip implementation
Expand All @@ -39,7 +41,8 @@ func (a AWSSigningTransport) RoundTrip(req *http.Request) (*http.Response, error
}

func createAWSClient() (*http.Client, error) {
signingTransport := AWSSigningTransport{HTTPClient: http.DefaultClient}
//signingTransport := AWSSigningTransport{HTTPClient: http.DefaultClient}
signingTransport := AWSSigningTransport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}}
signingTransport.newSession()

return &http.Client{Transport: http.RoundTripper(signingTransport)}, nil
Expand Down

0 comments on commit a45b978

Please sign in to comment.