Class: Nonnative::HTTPProxyServer

Inherits:
HTTPServer show all
Defined in:
lib/nonnative/http_proxy_server.rb

Overview

Runs HTTPProxy as a Puma-based in-process server under Nonnative.

Examples:

Nonnative.configure do |config|
  config.server do |s|
    s.name = 'github-proxy'
    s.klass = Nonnative::Features::HTTPProxyServer
    s.timeout = 2
    s.host = '127.0.0.1'
    s.port = 4567
    s.log = 'proxy.log'
  end
end

# In your server subclass:
# class HTTPProxyServer < Nonnative::HTTPProxyServer
#   def initialize(service)
#     super('api.github.com', service)
#   end
# end

See Also:

Instance Attribute Summary

Attributes inherited from Runner

#proxy

Instance Method Summary collapse

Methods inherited from Server

#start, #stop

Methods inherited from Runner

#name

Constructor Details

#initialize(host, service) ⇒ HTTPProxyServer

Returns a new instance of HTTPProxyServer.

Parameters:



101
102
103
104
105
106
107
108
109
# File 'lib/nonnative/http_proxy_server.rb', line 101

def initialize(host, service)
  app = Sinatra.new(Nonnative::HTTPProxy) do
    configure do
      set :host, host
    end
  end

  super(app, service)
end