Class: InfluxDB::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/influxdb/config.rb

Overview

InfluxDB client configuration

Constant Summary collapse

AUTH_METHODS =
["params".freeze, "basic_auth".freeze, "none".freeze].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Config

Returns a new instance of Config.



30
31
32
33
34
35
36
37
38
39
# File 'lib/influxdb/config.rb', line 30

def initialize(opts = {})
  extract_http_options!(opts)
  extract_ssl_options!(opts)
  extract_database_options!(opts)
  extract_writer_options!(opts)
  extract_query_options!(opts)

  configure_retry! opts.fetch(:retry, nil)
  configure_hosts! opts[:hosts] || opts[:host] || "localhost".freeze
end

Instance Attribute Details

#asyncObject (readonly)

Returns the value of attribute async.



28
29
30
# File 'lib/influxdb/config.rb', line 28

def async
  @async
end

#auth_methodObject

Returns the value of attribute auth_method.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def auth_method
  @auth_method
end

#chunk_sizeObject

Returns the value of attribute chunk_size.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def chunk_size
  @chunk_size
end

#databaseObject

Returns the value of attribute database.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def database
  @database
end

#denormalizeObject

Returns the value of attribute denormalize.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def denormalize
  @denormalize
end

#discard_write_errorsObject

Returns the value of attribute discard_write_errors.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def discard_write_errors
  @discard_write_errors
end

#epochObject

Returns the value of attribute epoch.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def epoch
  @epoch
end

#initial_delayObject

Returns the value of attribute initial_delay.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def initial_delay
  @initial_delay
end

#max_delayObject

Returns the value of attribute max_delay.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def max_delay
  @max_delay
end

#open_timeoutObject

Returns the value of attribute open_timeout.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def open_timeout
  @open_timeout
end

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def password
  @password
end

#portObject

Returns the value of attribute port.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def port
  @port
end

#prefixObject

Returns the value of attribute prefix.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def prefix
  @prefix
end

#read_timeoutObject

Returns the value of attribute read_timeout.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def read_timeout
  @read_timeout
end

#retryObject

Returns the value of attribute retry.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def retry
  @retry
end

#ssl_ca_certObject

Returns the value of attribute ssl_ca_cert.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def ssl_ca_cert
  @ssl_ca_cert
end

#time_precisionObject

Returns the value of attribute time_precision.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def time_precision
  @time_precision
end

#udpObject (readonly)

Returns the value of attribute udp.



28
29
30
# File 'lib/influxdb/config.rb', line 28

def udp
  @udp
end

#use_sslObject

Returns the value of attribute use_ssl.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def use_ssl
  @use_ssl
end

#usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def username
  @username
end

#verify_sslObject

Returns the value of attribute verify_ssl.



8
9
10
# File 'lib/influxdb/config.rb', line 8

def verify_ssl
  @verify_ssl
end

Instance Method Details

#async?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/influxdb/config.rb', line 45

def async?
  async != false
end

#hostsObject



55
56
57
58
59
60
61
# File 'lib/influxdb/config.rb', line 55

def hosts
  Array.new(@hosts_queue.length) do
    host = @hosts_queue.pop
    @hosts_queue.push(host)
    host
  end
end

#next_hostObject



49
50
51
52
53
# File 'lib/influxdb/config.rb', line 49

def next_host
  host = @hosts_queue.pop
  @hosts_queue.push(host)
  host
end

#udp?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/influxdb/config.rb', line 41

def udp?
  udp != false
end