class InfluxDB::AsyncQueue::Config

Constants

ATTRIBUTES

Attributes

adapter[W]
influxdb_client[W]
logger[W]

Public Class Methods

load_from_file!(path) click to toggle source
# File lib/influxdb/async_queue/config.rb, line 21
def self.load_from_file!(path)
  new(
    YAML.load(File.open(path))
  )
end
new(config = {}) click to toggle source
# File lib/influxdb/async_queue/config.rb, line 27
def initialize(config = {})
  @config = Hash[config.map { |k,v| [k.to_s, v] }]
  @config['adapter'] ||= {}
  @config['influxdb'] ||= {}
end

Public Instance Methods

adapter() click to toggle source
# File lib/influxdb/async_queue/config.rb, line 47
def adapter
  @adapter ||= ::InfluxDB::AsyncQueue::Adapters.const_get(adapter_name.camelize).new(
    *(adapter_config || [])
  )
end
influxdb_client() click to toggle source
# File lib/influxdb/async_queue/config.rb, line 57
def influxdb_client
  @influxdb_client ||= ::InfluxDB::Client.new(
    username: influxdb_username,
    password: influxdb_password,
    hosts: influxdb_hosts,
    port: influxdb_port,
    async: false,
    retry: true,
    time_precision: influxdb_precision
  )
end
logger() click to toggle source
# File lib/influxdb/async_queue/config.rb, line 53
def logger
  @logger ||= Logger.new($stdout)
end