Method: Honeybadger::Config::Yaml.new

Defined in:
lib/honeybadger/config/yaml.rb

.new(path, env = "production") ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/honeybadger/config/yaml.rb', line 10

def self.new(path, env = "production")
  path = path.is_a?(Pathname) ? path : Pathname.new(path)

  if !path.exist?
    raise ConfigError, "The configuration file #{path} was not found."
  elsif !path.file?
    raise ConfigError, "The configuration file #{path} is not a file."
  elsif !path.readable?
    raise ConfigError, "The configuration file #{path} is not readable."
  end

  yaml = load_yaml(path)
  yaml.merge!(yaml[env]) if yaml[env].is_a?(Hash)

  dotify_keys(yaml)
end