Class: Bifrossht::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/bifrossht/config.rb,
lib/bifrossht/config/element.rb,
lib/bifrossht/config/connection.rb,
lib/bifrossht/config/host_filter.rb

Defined Under Namespace

Classes: Connection, Element, HostFilter

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config


10
11
12
# File 'lib/bifrossht/config.rb', line 10

def config
  @config
end

Class Method Details

.connectionsObject


22
23
24
# File 'lib/bifrossht/config.rb', line 22

def connections
  @connections ||= build_subconfig('connections', Config::Connection)
end

.host_filtersObject


18
19
20
# File 'lib/bifrossht/config.rb', line 18

def host_filters
  @host_filters ||= build_subconfig('host_filters', Config::HostFilter)
end

.load_config(path) ⇒ Object


12
13
14
15
16
# File 'lib/bifrossht/config.rb', line 12

def load_config(path)
  @config = YAML.load_file(File.expand_path(path)) || {}
rescue Errno::ENOENT => e
  raise ParameterError, "Configuration file: #{e.message}"
end