Skip to content

Commit

Permalink
Merge pull request #5 from opcr-io/gertd/certpool-windows
Browse files Browse the repository at this point in the history
windows system cert pool failure
  • Loading branch information
viovanov authored Oct 6, 2021
2 parents f49a7b2 + b69d4e5 commit bbc715e
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 bbc715e

Please sign in to comment.