influxdata / influxdb-rails

Ruby on Rails bindings to automatically write metrics into InfluxDB
MIT License
212 stars 63 forks source link

More flexible client configuration #95

Open anlek opened 4 years ago

anlek commented 4 years ago

With the following config:

InfluxDB::Rails.configure do |config|
  config.client.hosts = ['localhost']
  config.client.port = 8086
  config.client.username = 'root'
  config.client.password = 'pa$$word'
  config.client.auth_method = 'basic_auth'

When my app loads, I get a undefined method 'auth_method=' for #<InfluxDB::Rails::ClientConfig:0x000055af834ef718> (NoMethodError)

However, if I remove it and enter a rails console, I can set it to InfluxDB::Rails.client.config.auth_method = 'basic_auth' and am able to write_point without any issues.

Am I missing something?

hennevogel commented 4 years ago

I guess we shouldn't hardcode client configuration and allow anything you want to pass in so we don't have to run after influxdb-ruby options.

radiospiel commented 4 years ago

:+1: on this. That this gem only allows a limited number of configuration options is no benefit to any user. Also, if influxdb-ruby ever changes configuration on their end this gem must follow suit, or else it becomes unusable.