Skip to content

Commit

Permalink
Add System CA certs to http calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jmccann committed Mar 7, 2016
1 parent d0d6217 commit 510fc6e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drone/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import (
"net/url"

"golang.org/x/oauth2"

"github.com/jackspirou/syscerts"
"crypto/tls"
)

const (
Expand Down Expand Up @@ -47,6 +50,12 @@ func NewClient(uri string) Client {
func NewClientToken(uri, token string) Client {
config := new(oauth2.Config)
auther := config.Client(oauth2.NoContext, &oauth2.Token{AccessToken: token})

// Add CA certs
certs := syscerts.SystemRootsPool()
tlsConfig := &tls.Config{RootCAs: certs}
auther.Transport = &http.Transport{TLSClientConfig: tlsConfig}

return &client{auther, uri}
}

Expand Down

0 comments on commit 510fc6e

Please sign in to comment.