class InfluxDB::Config

InfluxDB client configuration

Constants

AUTH_METHODS

Attributes

async[R]
auth_method[RW]
database[RW]
denormalize[RW]
hosts[RW]
initial_delay[RW]
max_delay[RW]
open_timeout[RW]
password[RW]
port[RW]
read_timeout[RW]
retry[RW]
time_precision[RW]
udp[R]
use_ssl[RW]
username[RW]

Public Class Methods

new(opts = {}) click to toggle source

rubocop:disable all

# File lib/influxdb/config.rb, line 24
def initialize(opts = {})
  @database = opts[:database]
  @hosts = Array(opts[:hosts] || opts[:host] || ["localhost"])
  @port = opts.fetch(:port, 8086)
  @username = opts.fetch(:username, "root")
  @password = opts.fetch(:password, "root")
  @auth_method = AUTH_METHODS.include?(opts[:auth_method]) ? opts[:auth_method] : "params"
  @use_ssl = opts.fetch(:use_ssl, false)
  @time_precision = opts.fetch(:time_precision, "s")
  @initial_delay = opts.fetch(:initial_delay, 0.01)
  @max_delay = opts.fetch(:max_delay, 30)
  @open_timeout = opts.fetch(:write_timeout, 5)
  @read_timeout = opts.fetch(:read_timeout, 300)
  @async = opts.fetch(:async, false)
  @udp = opts.fetch(:udp, false)
  @retry = opts.fetch(:retry, nil)
  @denormalize = opts.fetch(:denormalize, true)
  @retry =
    case @retry
    when Integer
      @retry
    when true, nil
      -1
    when false
      0
    end
end

Public Instance Methods

async?() click to toggle source
# File lib/influxdb/config.rb, line 56
def async?
  !!async
end
udp?() click to toggle source
# File lib/influxdb/config.rb, line 52
def udp?
  !!udp
end