Skip to content

Commit 1d203b9

Browse files
committed
Add log message to indicate what profile is used and tls config support
1 parent 48cd12f commit 1d203b9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

clicommand/agent_start.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,8 @@ var AgentStartCommand = cli.Command{
11011101
l.Info("Agents will disconnect after %d seconds of inactivity", agentConf.DisconnectAfterIdleTimeout)
11021102
}
11031103

1104+
l.Info("Using http client profile: %s", cfg.HTTPClientProfile)
1105+
11041106
if len(cfg.AllowedRepositories) > 0 {
11051107
agentConf.AllowedRepositories = make([]*regexp.Regexp, 0, len(cfg.AllowedRepositories))
11061108
for _, v := range cfg.AllowedRepositories {

internal/agenthttp/client.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,23 @@ func NewClient(opts ...ClientOption) *http.Client {
2626
opt(&conf)
2727
}
2828

29+
// http client profile is used to switch between different http client implementations
30+
// - stdlib: uses the standard library http client
2931
switch conf.HTTPClientProfile {
3032
case "stdlib":
33+
// Base any modifications on the default transport.
34+
transport := http.DefaultTransport.(*http.Transport).Clone()
35+
36+
if conf.TLSConfig != nil {
37+
transport.TLSClientConfig = conf.TLSConfig
38+
}
39+
3140
return &http.Client{
3241
Timeout: conf.Timeout,
3342
Transport: &authenticatedTransport{
3443
Bearer: conf.Bearer,
3544
Token: conf.Token,
36-
Delegate: http.DefaultTransport,
45+
Delegate: transport,
3746
},
3847
}
3948
}

0 commit comments

Comments
 (0)