fix(parsers.avro): Only attempt to read CA cert file if filename is not empty string (#13939)
This commit is contained in:
parent
c0bcf31bc6
commit
a542899811
|
|
@ -29,14 +29,13 @@ type schemaRegistry struct {
|
||||||
const schemaByID = "%s/schemas/ids/%d"
|
const schemaByID = "%s/schemas/ids/%d"
|
||||||
|
|
||||||
func newSchemaRegistry(addr string, caCertPath string) (*schemaRegistry, error) {
|
func newSchemaRegistry(addr string, caCertPath string) (*schemaRegistry, error) {
|
||||||
caCert, err := os.ReadFile(caCertPath)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var client *http.Client
|
var client *http.Client
|
||||||
var tlsCfg *tls.Config
|
var tlsCfg *tls.Config
|
||||||
if caCertPath != "" {
|
if caCertPath != "" {
|
||||||
|
caCert, err := os.ReadFile(caCertPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
caCertPool := x509.NewCertPool()
|
caCertPool := x509.NewCertPool()
|
||||||
caCertPool.AppendCertsFromPEM(caCert)
|
caCertPool.AppendCertsFromPEM(caCert)
|
||||||
tlsCfg = &tls.Config{
|
tlsCfg = &tls.Config{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue