From 510fc6ed221431c48cd25c58d678d22e4eb8b2b6 Mon Sep 17 00:00:00 2001 From: Jacob McCann Date: Wed, 2 Mar 2016 14:35:34 -0600 Subject: [PATCH] Add System CA certs to http calls --- drone/client.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drone/client.go b/drone/client.go index 5b69df8..5631b31 100644 --- a/drone/client.go +++ b/drone/client.go @@ -13,6 +13,9 @@ import ( "net/url" "golang.org/x/oauth2" + + "github.com/jackspirou/syscerts" + "crypto/tls" ) const ( @@ -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} }