fix(parsers.avro): Only attempt to read CA cert file if filename is not empty string (#13939)

This commit is contained in:
Adam Thornton 2023-09-19 01:42:12 -07:00 committed by GitHub
parent c0bcf31bc6
commit a542899811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 5 deletions

View File

@ -29,14 +29,13 @@ type schemaRegistry struct {
const schemaByID = "%s/schemas/ids/%d"
func newSchemaRegistry(addr string, caCertPath string) (*schemaRegistry, error) {
caCert, err := os.ReadFile(caCertPath)
if err != nil {
return nil, err
}
var client *http.Client
var tlsCfg *tls.Config
if caCertPath != "" {
caCert, err := os.ReadFile(caCertPath)
if err != nil {
return nil, err
}
caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM(caCert)
tlsCfg = &tls.Config{