class StickyElephant::Configuration
Attributes
abort_on_exception[R]
debug[R]
debug?[R]
host[R]
hpf_host[R]
hpf_ident[R]
hpf_port[R]
hpf_secret[R]
log_level[R]
log_path[R]
port[R]
use_hpf[R]
use_hpf?[R]
use_hpfeeds[R]
use_hpfeeds?[R]
Public Class Methods
new(configuration_path = "./sticky_elephant.conf")
click to toggle source
from_cli: log_path
: “./sticky_elephant.log”,
port: 5432, host: '0.0.0.0', log_level: Logger::INFO, abort_on_exception: false
# 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
Private Instance Methods
check_hpf_configuration!()
click to toggle source
# File lib/sticky_elephant/configuration.rb, line 36 def check_hpf_configuration! error_messages = [] (error_messages << "Invalid HPF host") if hpf_host.nil? || hpf_host.empty? (error_messages << "Invalid HPF ident") if hpf_ident.nil? || hpf_ident.empty? (error_messages << "Invalid HPF secret") if hpf_secret.nil? || hpf_secret.empty? abort(error_messages.join(", ")) unless error_messages.empty? end