Module: NagiosHerald::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/nagios-herald/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

Returns the value of attribute config.



8
9
10
# File 'lib/nagios-herald/config.rb', line 8

def config
  @config
end

Instance Method Details

#load(options = {}) ⇒ Object

Public: Load the configuration file for use globally.

options - The options hash built from command-line arguments.

Returns a hash of the parsed config file merged with the command line options.



15
16
17
18
19
20
21
22
# File 'lib/nagios-herald/config.rb', line 15

def load(options = {})
  abort("Config file not found #{options['config_file']}") unless File.exists? options['config_file']
  @config = AppConf.new
  @config.load(options['config_file'])
  @config = @config.to_hash
  @config.merge!(options)   # runtime options should override
  @config
end