Sha256: b5b8b8234eed17f7d36a8ed9562a4565b1380d5ea26a43a4ef51116b1f0a7f24
Contents?: true
Size: 684 Bytes
Versions: 8
Compression:
Stored size: 684 Bytes
Contents
require 'yaml' require 'net/http' module Hydra class UnknownProxyType < RuntimeError end class ProxyConfig 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 end end
Version data entries
8 entries across 8 versions & 3 rubygems