Skip to content

Commit

Permalink
Exposing TLS Configuration via Connection (#84)
Browse files Browse the repository at this point in the history
* Exposing client variables

* Exposing TLS Config via Connection

* Merge issue
  • Loading branch information
nigurr authored Aug 12, 2020
1 parent 0eaf2fc commit 809f645
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion azuredevops/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ var versionSuffix = " (dev)"
var baseUserAgent = "go/" + runtime.Version() + " (" + runtime.GOOS + " " + runtime.GOARCH + ") azure-devops-go-api/" + version + versionSuffix

func NewClient(connection *Connection, baseUrl string) *Client {
client := &http.Client{}
var client *http.Client

if connection.TlsConfig != nil {
client = &http.Client{Transport: &http.Transport{TLSClientConfig: connection.TlsConfig}}
} else {
client = &http.Client{}
}

if connection.Timeout != nil {
client.Timeout = *connection.Timeout
}
Expand Down
5 changes: 4 additions & 1 deletion azuredevops/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ package azuredevops

import (
"context"
"crypto/tls"
"encoding/base64"
"github.com/google/uuid"
"strings"
"sync"
"time"

"github.com/google/uuid"
)

// Creates a new Azure DevOps connection instance using a personal access token.
Expand Down Expand Up @@ -38,6 +40,7 @@ type Connection struct {
SuppressFedAuthRedirect bool
ForceMsaPassThrough bool
Timeout *time.Duration
TlsConfig *tls.Config
clientCache map[string]Client
clientCacheLock sync.RWMutex
resourceAreaCache map[uuid.UUID]ResourceAreaInfo
Expand Down

0 comments on commit 809f645

Please sign in to comment.