Sha256: 652ae759b3ae9a6cf6ff8d4e433512c9a2ab473ede589b99cb313a2bd5537eaa

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

require 'app_conf'

module NagiosHerald
  module Config
    extend self

    @config = {}
    attr_accessor :config

    # 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.
    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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nagios-herald-0.0.4 lib/nagios-herald/config.rb
nagios-herald-0.0.3 lib/nagios-herald/config.rb
nagios-herald-0.0.2 lib/nagios-herald/config.rb