Skip to content

Commit

Permalink
Handle unset cert and key
Browse files Browse the repository at this point in the history
Signed-off-by: Levi Harrison <git@leviharrison.dev>

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
  • Loading branch information
LeviHarrison authored and simonpasquier committed Jul 8, 2022
1 parent d916914 commit 6f1d8df
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions config/http_config.go
Expand Up @@ -902,11 +902,14 @@ func (t *tlsRoundTripper) getTLSFilesWithHash() ([]byte, []byte, []byte, []byte,
}
h1 := sha256.Sum256(b1)

b2, b3, err := readCertAndKey(t.certFile, t.keyFile)
if err != nil {
return nil, nil, nil, nil, err
var h2, h3 [32]byte
if t.certFile != "" {
b2, b3, err := readCertAndKey(t.certFile, t.keyFile)
if err != nil {
return nil, nil, nil, nil, err
}
h2, h3 = sha256.Sum256(b2), sha256.Sum256(b3)
}
h2, h3 := sha256.Sum256(b2), sha256.Sum256(b3)

return b1, h1[:], h2[:], h3[:], nil
}
Expand Down

0 comments on commit 6f1d8df

Please sign in to comment.