lib/oxidized/web.rb in oxidized-web-0.1.0 vs lib/oxidized/web.rb in oxidized-web-0.1.1

- old
+ new

@@ -1,19 +1,30 @@ module Oxidized module API class Web + require 'rack/handler' attr_reader :thread + Rack::Handler::WEBrick = Rack::Handler.get(:puma) def initialize nodes, listen require 'oxidized/web/webapp' - addr, port = listen.to_s.split ':' + listen, uri = listen.split '/' + addr, port = listen.split ':' port, addr = addr, nil if not port - WebApp.set :server, %w(puma) - WebApp.set :bind, addr if addr - WebApp.set :port, port + uri = '/' + uri.to_s + @opts = { + :Host => addr, + :Port => port, + } WebApp.set :nodes, nodes + @app = Rack::Builder.new do + map uri do + run WebApp + end + end end + def run - @thread = Thread.new { WebApp.run! } + @thread = Thread.new { Rack::Handler::Puma.run @app, @opts } end end end end