Remove hardcoded url schema

This commit is contained in:
Mak Muftic 2021-09-24 12:40:33 +02:00
parent e46da5a181
commit 94a1601ab2

View File

@ -18,11 +18,15 @@ const (
func NewElasticSearchTransport(connectionString string) (TracerTransport, error) { func NewElasticSearchTransport(connectionString string) (TracerTransport, error) {
conUrl, err := url.Parse(connectionString) conUrl, err := url.Parse(connectionString)
if err != nil {
return nil, err
}
username := conUrl.User.Username() username := conUrl.User.Username()
password, _ := conUrl.User.Password() password, _ := conUrl.User.Password()
cfg := elasticsearch.Config{ cfg := elasticsearch.Config{
Addresses: []string{ Addresses: []string{
"https://" + conUrl.Host, conUrl.Scheme + conUrl.Host,
}, },
Username: username, Username: username,
Password: password, Password: password,