public void UpdateSetting(InfluxDbSetting setting)
        {
            this.Dispose();

            if (string.IsNullOrWhiteSpace(setting.Token))
            {
                _influxDBClient = InfluxDBClientFactory.Create(
                    $"http://{setting.Host}:{setting.Port}"
                    , setting.Username
                    , setting.Password.ToCharArray()
                    );
            }
            else
            {
                _influxDBClient = InfluxDBClientFactory.Create(
                    $"http://{setting.Host}:{setting.Port}"
                    , setting.Token.ToCharArray()
                    );
            }
        }
 public InfluxDbConnection(InfluxDbSetting setting)
 {
     this.UpdateSetting(setting);
 }
 static public void AddInfluxDb(this IServiceCollection services, InfluxDbSetting setting)
 {
     services.AddSingleton <IInfluxDbConnection>(x => new InfluxDbConnection(setting));
     services.AddTransient <IInfluxWriter, InfluxWriter>();
     services.AddTransient <IInfluxReader, InfluxReader>();
 }