Add condition to cert in sentry

Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
Philip Laine 2021-04-20 00:12:45 +02:00
parent a2377a84b9
commit c27e013b39
1 changed files with 8 additions and 4 deletions

View File

@ -33,13 +33,17 @@ type Sentry struct {
// NewSentry creates a Sentry client from the provided Data Source Name (DSN)
func NewSentry(certPool *x509.CertPool, dsn string) (*Sentry, error) {
client, err := sentry.NewClient(sentry.ClientOptions{
Dsn: dsn,
HTTPTransport: &http.Transport{
var tr *http.Transport
if certPool != nil {
tr = &http.Transport{
TLSClientConfig: &tls.Config{
RootCAs: certPool,
},
},
}
}
client, err := sentry.NewClient(sentry.ClientOptions{
Dsn: dsn,
HTTPTransport: tr,
})
if err != nil {
return nil, err