Class: ISPMonitor::Config
- Inherits:
-
Object
- Object
- ISPMonitor::Config
- Defined in:
- lib/isp_monitor/config.rb
Instance Attribute Summary collapse
- #checks ⇒ Object
- #config_file ⇒ Object
- #config_file_path ⇒ Object
- #logstash_host ⇒ Object
- #logstash_port ⇒ Object
Instance Attribute Details
#checks ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/isp_monitor/config.rb', line 29 def checks @checks ||= begin config_file.fetch(:checks, []).map do |config| ISPMonitor::Checks.lookup(config[:type].to_sym).new(config) end end end |
#config_file ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/isp_monitor/config.rb', line 8 def config_file @config_file ||= begin if File.exist?(config_file_path) Psych.safe_load_file(config_file_path, symbolize_names: true) else {} end end end |
#config_file_path ⇒ Object
3 4 5 |
# File 'lib/isp_monitor/config.rb', line 3 def config_file_path @config_file_path ||= ENV.fetch('CONFIG_FILE_PATH', File.('isp_monitor.yml', Dir.pwd)).strip.presence end |
#logstash_host ⇒ Object
19 20 21 |
# File 'lib/isp_monitor/config.rb', line 19 def logstash_host @logstash_host ||= ENV.fetch('LOGSTASH_HOST', '').strip.presence end |
#logstash_port ⇒ Object
24 25 26 |
# File 'lib/isp_monitor/config.rb', line 24 def logstash_port @logstash_host ||= ENV.fetch('LOGSTASH_PORT', '50000').strip.presence.to_i end |