Skip to content

fix: sink HTTP clients to read proxy config from environment #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/sinks/alertmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
if ok {
caCertPool, err = x509.SystemCertPool()
if err != nil {
return errors.Wrap(err, "invalid Alertmanager config: failed to get system cert pool")
s.log.Error(err, "failed to get system cert pool; using empty pool")
caCertPool = x509.NewCertPool()

Check warning on line 88 in internal/sinks/alertmanager.go

View check run for this annotation

Codecov / codecov/patch

internal/sinks/alertmanager.go#L87-L88

Added lines #L87 - L88 were not covered by tests
}
caCertPool.AppendCertsFromPEM(caCert)
}
Expand Down
5 changes: 2 additions & 3 deletions internal/sinks/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ type Client struct {

// NewClient returns a new Client with the provided timeout.
func NewClient(timeout time.Duration) *Client {
client := &http.Client{
Timeout: timeout,
}
client := http.DefaultClient // inherit http.ProxyFromEnvironment
client.Timeout = timeout
return &Client{
hclient: client,
}
Expand Down