Class: StickyElephant::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/sticky_elephant/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration_path = "./sticky_elephant.conf") ⇒ Configuration

from_cli: log_path: “./sticky_elephant.log”,

port: 5432, host: '0.0.0.0',
log_level: Logger::INFO,
abort_on_exception: false


15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sticky_elephant/configuration.rb', line 15

def initialize(configuration_path = "./sticky_elephant.conf")
  conf                = YAML.load_file(configuration_path)
  @port               = conf.fetch(:port, 5432)
  @host               = conf.fetch(:host, '0.0.0.0')
  @debug              = conf.fetch(:debug, false)
  @log_path           = conf.fetch(:log_path, './sticky_elephant.log')
  @abort_on_exception = conf.fetch(:abort_on_exception, false)
  @hpf_host           = conf.fetch(:hpf_host, nil)
  @hpf_port           = conf.fetch(:hpf_port, 10_000)
  @hpf_ident          = conf.fetch(:hpf_ident, nil)
  @hpf_secret         = conf.fetch(:hpf_secret, nil)
  @use_hpf            = conf.fetch(:use_hpf, false)
  check_hpf_configuration! if use_hpf?
end

Instance Attribute Details

#abort_on_exceptionObject (readonly)

Returns the value of attribute abort_on_exception.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def abort_on_exception
  @abort_on_exception
end

#debugObject (readonly) Also known as: debug?

Returns the value of attribute debug.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def debug
  @debug
end

#hostObject (readonly)

Returns the value of attribute host.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def host
  @host
end

#hpf_hostObject (readonly)

Returns the value of attribute hpf_host.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def hpf_host
  @hpf_host
end

#hpf_identObject (readonly)

Returns the value of attribute hpf_ident.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def hpf_ident
  @hpf_ident
end

#hpf_portObject (readonly)

Returns the value of attribute hpf_port.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def hpf_port
  @hpf_port
end

#hpf_secretObject (readonly)

Returns the value of attribute hpf_secret.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def hpf_secret
  @hpf_secret
end

#log_levelObject (readonly)

Returns the value of attribute log_level.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def log_level
  @log_level
end

#log_pathObject (readonly)

Returns the value of attribute log_path.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def log_path
  @log_path
end

#portObject (readonly)

Returns the value of attribute port.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def port
  @port
end

#use_hpfObject (readonly) Also known as: use_hpf?, use_hpfeeds, use_hpfeeds?

Returns the value of attribute use_hpf.



3
4
5
# File 'lib/sticky_elephant/configuration.rb', line 3

def use_hpf
  @use_hpf
end