lib/oxidized/web.rb in oxidized-web-0.13.1 vs lib/oxidized/web.rb in oxidized-web-0.14.0
- old
+ new
@@ -1,22 +1,25 @@
require 'json'
module Oxidized
module API
class Web
- require 'rack/handler'
+ require 'rack/handler/puma'
attr_reader :thread
- Rack::Handler::WEBrick = Rack::Handler.get(:puma)
- def initialize nodes, listen
+
+ def initialize(nodes, listen)
require 'oxidized/web/webapp'
listen, uri = listen.split '/'
addr, _, port = listen.rpartition ':'
- port, addr = addr, nil if not port
- uri = '/' + uri.to_s
+ unless port
+ port = addr
+ addr = nil
+ end
+ uri = "/#{uri}"
@opts = {
Host: addr,
- Port: port,
+ Port: port
}
WebApp.set :nodes, nodes
@app = Rack::Builder.new do
map uri do
run WebApp
@@ -24,10 +27,10 @@
end
end
def run
@thread = Thread.new do
- Rack::Handler::Puma.run @app, @opts
+ Rack::Handler::Puma.run @app, **@opts
exit!
end
end
end
end