Skip to content

Commit

Permalink
windows system cert pool failure
Browse files Browse the repository at this point in the history
  • Loading branch information
gertd committed Oct 6, 2021
1 parent f49a7b2 commit b69d4e5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/app/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@ import (
"io/ioutil"
"log"
"net/http"
"runtime"
)

func (c *PolicyApp) TransportWithTrustedCAs() *http.Transport {
// Get the SystemCertPool, continue with an empty pool on error
rootCAs, err := x509.SystemCertPool()
if err != nil {
c.UI.Problem().WithErr(err).WithEnd(1).Msg("Failed to load system cert pool.")
var (
rootCAs *x509.CertPool
err error
)
if runtime.GOOS != `windows` {
rootCAs, err = x509.SystemCertPool()
if err != nil {
c.UI.Problem().WithErr(err).WithEnd(1).Msg("Failed to load system cert pool.")
}
}
if rootCAs == nil {
rootCAs = x509.NewCertPool()
Expand Down

0 comments on commit b69d4e5

Please sign in to comment.