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>
  • Loading branch information
LeviHarrison committed Mar 13, 2022
1 parent 102c12a commit e06f022
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions config/http_config.go
Expand Up @@ -830,11 +830,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 e06f022

Please sign in to comment.