summaryrefslogtreecommitdiff
path: root/lib/oxidized/api/web.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/api/web.rb')
-rw-r--r--lib/oxidized/api/web.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/oxidized/api/web.rb b/lib/oxidized/api/web.rb
new file mode 100644
index 0000000..9a5a507
--- /dev/null
+++ b/lib/oxidized/api/web.rb
@@ -0,0 +1,19 @@
+module Oxidized
+ module API
+ class Web
+ attr_reader :thread
+ def initialize nodes, listen
+ require 'oxidized/api/web/webapp'
+ addr, port = listen.to_s.split ':'
+ port, addr = addr, nil if not port
+ WebApp.set :server, %w(puma)
+ WebApp.set :bind, addr if addr
+ WebApp.set :port, port
+ WebApp.set :nodes, nodes
+ end
+ def run
+ @thread = Thread.new { WebApp.run! }
+ end
+ end
+ end
+end