Files
ab99a1bb2e Use the standard errors package to create, wrap, and handle errors (#2955)
* Standardise error formatting using standard library errors package

* Standardise improve non-idiomatic error messages

* Make github.com/pkg/errors an indirect dependency

Co-authored-by: A. Stoewer <[email protected]>
2023-09-26 17:39:47 +10:00

35 lines
578 B
Go

package otlpgrpc
import (
"errors"
"github.com/grafana/dskit/flagext"
)
type Config struct {
Endpoints flagext.StringSlice `yaml:"endpoints"`
TLS TLSConfig `yaml:"tls"`
}
func (cfg *Config) Validate() error {
// TODO: Validate if endpoints are in form host:port?
return cfg.TLS.Validate()
}
type TLSConfig struct {
Insecure bool `yaml:"insecure"`
CertFile string `yaml:"cert_file"`
}
func (cfg *TLSConfig) Validate() error {
if cfg.Insecure {
return nil
}
if cfg.CertFile == "" {
return errors.New("cert_file is empty")
}
return nil
}