Class: OktaAuthProxy::ProxyServer

Inherits:
Object
  • Object
show all
Defined in:
lib/okta-auth-proxy/server.rb

Instance Method Summary collapse

Constructor Details

#initialize(port: 3311, threads: 1000, bind: '127.0.0.1', debug: false) ⇒ ProxyServer

Returns a new instance of ProxyServer.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/okta-auth-proxy/server.rb', line 7

def initialize(port: 3311, threads:1000, bind: '127.0.0.1', debug:false)
  debug ||= ENV['DEBUG']

  if debug
    $stdout.sync = true
    $stderr.sync = true
  end

  app = ProxyApp.new
  dispatch = Rack::Builder.app do
    map '/' do
      run app
    end
  end
  @server = Thin::Server.new(port, bind, dispatch, threadpool_size: threads).backend
end

Instance Method Details

#runObject



28
29
30
31
32
33
# File 'lib/okta-auth-proxy/server.rb', line 28

def run
  EM.run do
    init_sighandlers
    @server.start
  end
end

#startObject



24
25
26
# File 'lib/okta-auth-proxy/server.rb', line 24

def start
  @server.start
end