Class: Hydra::ProxyConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/hydra/proxy_config.rb

Class Method Summary collapse

Class Method Details

.load(config_yml) ⇒ Object



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

def self.load(config_yml)
  config = YAML::load(config_yml)
  if config.has_key?('proxy')
    proxy_info = config['proxy']
    #only file supported so far
    if proxy_info['type'] == "file"
      YAML::load_file(proxy_info['path'])
    elsif proxy_info['type'] == "http"
      YAML::load(Net::HTTP.get(URI.parse(proxy_info['path'])))
    else
      raise UnknownProxyType.new("Proxy config file does not know what to do with type '#{proxy_info["type"]}'.")
    end
  else
    config
  end
end