class Config

Constants

FLUENTD

Attributes

config[RW]
root_path[RW]

Public Instance Methods

[](key) click to toggle source
# File lib/rforward/config.rb, line 13
def [](key)
  config = @config || sample
  config[key.to_s]
end
create_sample_config(config_path) click to toggle source
# File lib/rforward/config.rb, line 18
def create_sample_config config_path
  RLogger.instance.info "Config created (#{config_path})"

  File.open(config_path,"w") do |file|
    file.write sample.to_yaml
  end
end
load_config(config_path) click to toggle source
# File lib/rforward/config.rb, line 9
def load_config config_path
  @config = YAML.load_file config_path
end

Private Instance Methods

sample() click to toggle source
# File lib/rforward/config.rb, line 28
def sample
  hash = {
    'fluentd_host' => 'localhost',
    'fluentd_port' => '24224',
    'tag' => 'event',
    'flush_delay' => '20',
    'flush_threshold' => '100000',
    'time_key' => 'time',
    'time_format' => '%Y-%m-%dT%H:%M:%S%z',
    'index_key' => 'index_key'
  }
end