Class: StickyElephant::Configuration
- Inherits:
-
Object
- Object
- StickyElephant::Configuration
- Defined in:
- lib/sticky_elephant/configuration.rb
Instance Attribute Summary collapse
-
#abort_on_exception ⇒ Object
readonly
Returns the value of attribute abort_on_exception.
-
#debug ⇒ Object
(also: #debug?)
readonly
Returns the value of attribute debug.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#hpf_host ⇒ Object
readonly
Returns the value of attribute hpf_host.
-
#hpf_ident ⇒ Object
readonly
Returns the value of attribute hpf_ident.
-
#hpf_port ⇒ Object
readonly
Returns the value of attribute hpf_port.
-
#hpf_secret ⇒ Object
readonly
Returns the value of attribute hpf_secret.
-
#log_level ⇒ Object
readonly
Returns the value of attribute log_level.
-
#log_path ⇒ Object
readonly
Returns the value of attribute log_path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#use_hpf ⇒ Object
(also: #use_hpf?, #use_hpfeeds, #use_hpfeeds?)
readonly
Returns the value of attribute use_hpf.
Instance Method Summary collapse
-
#initialize(configuration_path = "./sticky_elephant.conf") ⇒ Configuration
constructor
from_cli: log_path: “./sticky_elephant.log”, port: 5432, host: ‘0.0.0.0’, log_level: Logger::INFO, abort_on_exception: false.
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_exception ⇒ Object (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 |
#debug ⇒ Object (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 |
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/sticky_elephant/configuration.rb', line 3 def host @host end |
#hpf_host ⇒ Object (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_ident ⇒ Object (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_port ⇒ Object (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_secret ⇒ Object (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_level ⇒ Object (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_path ⇒ Object (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 |
#port ⇒ Object (readonly)
Returns the value of attribute port.
3 4 5 |
# File 'lib/sticky_elephant/configuration.rb', line 3 def port @port end |
#use_hpf ⇒ Object (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 |