Skip to content

Commit

Permalink
more linting
Browse files Browse the repository at this point in the history
Signed-off-by: erikbaranowski <39704712+erikbaranowski@users.noreply.github.com>
  • Loading branch information
erikbaranowski committed Apr 11, 2023
1 parent 0bb0602 commit d1d0620
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions config/configtls/configtls.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,16 @@ func (c TLSSetting) loadCertPool() (*x509.CertPool, error) {
var err error
var certPool *x509.CertPool

if len(c.CAFile) != 0 && len(c.CAPem) != 0 {
switch {
case len(c.CAFile) != 0 && len(c.CAPem) != 0:
return nil, fmt.Errorf("failed to load CA CertPool: CA File and PEM cannot both be provided")
} else if len(c.CAFile) != 0 {
case len(c.CAFile) != 0:
// Set up user specified truststore from file
certPool, err = c.loadCertFile(c.CAFile)
if err != nil {
return nil, fmt.Errorf("failed to load CA CertPool File: %w", err)
}
} else if len(c.CAPem) != 0 {
case len(c.CAPem) != 0:
// Set up user specified truststore from PEM
certPool, err = c.loadCertPem(c.CAPem)
if err != nil {
Expand Down

0 comments on commit d1d0620

Please sign in to comment.