influxdata / influxdb-csharp

A .NET library for efficiently sending points to InfluxDB 1.x
Apache License 2.0
199 stars 60 forks source link

Fix to issue 67: Add option to allow self signed certificate connection #68

Open cvalerio opened 5 years ago

cvalerio commented 5 years ago

Small change that allows users to pass a custom HttpMessageHandler to InfluxDb method, allowing to bypass certificate check for self signed certificates on server.

Usage:

         var handler = new HttpClientHandler
         {
            ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true
         };
         Metrics.Collector = new CollectorConfiguration()
            .Tag.With("host", Config["hostname"])
            .Batch.AtInterval(TimeSpan.FromSeconds(2))
            .WriteTo.InfluxDB(uri, Config["influxdbname"], Config["influxusername"], Config["influxpassword"], handler)
            .CreateCollector();