diff --git a/quesma/quesma/config/url.go b/quesma/quesma/config/url.go index 291329c4d..294b7bd4b 100644 --- a/quesma/quesma/config/url.go +++ b/quesma/quesma/config/url.go @@ -2,7 +2,10 @@ // SPDX-License-Identifier: Elastic-2.0 package config -import "net/url" +import ( + "fmt" + "net/url" +) type Url url.URL @@ -15,6 +18,12 @@ func (u *Url) UnmarshalText(text []byte) error { if err != nil { return err } + if len(urlValue.Scheme) == 0 { + return fmt.Errorf("URL scheme (e.g. http:// or clickhouse://) is missing from the provided URL: %s", urlValue) + } + if len(urlValue.Port()) == 0 { + return fmt.Errorf("URL port (e.g. 8123 in 'http://localhost:8123') is missing from the provided URL: %s", urlValue) + } *u = Url(*urlValue) return nil }