Skip to content

Commit 809f645

Browse files
authored
Exposing TLS Configuration via Connection (#84)
* Exposing client variables * Exposing TLS Config via Connection * Merge issue
1 parent 0eaf2fc commit 809f645

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

azuredevops/client.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,14 @@ var versionSuffix = " (dev)"
5151
var baseUserAgent = "go/" + runtime.Version() + " (" + runtime.GOOS + " " + runtime.GOARCH + ") azure-devops-go-api/" + version + versionSuffix
5252

5353
func NewClient(connection *Connection, baseUrl string) *Client {
54-
client := &http.Client{}
54+
var client *http.Client
55+
56+
if connection.TlsConfig != nil {
57+
client = &http.Client{Transport: &http.Transport{TLSClientConfig: connection.TlsConfig}}
58+
} else {
59+
client = &http.Client{}
60+
}
61+
5562
if connection.Timeout != nil {
5663
client.Timeout = *connection.Timeout
5764
}

azuredevops/connection.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ package azuredevops
55

66
import (
77
"context"
8+
"crypto/tls"
89
"encoding/base64"
9-
"github.com/google/uuid"
1010
"strings"
1111
"sync"
1212
"time"
13+
14+
"github.com/google/uuid"
1315
)
1416

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

0 commit comments

Comments
 (0)