module Honeybadger::Config::Yaml

def self.new(path, env = 'production')

def self.new(path, env = 'production')
  path = path.kind_of?(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].kind_of?(Hash)
  dotify_keys(yaml)
end