Class: Backdat::Server
- Inherits:
-
Object
- Object
- Backdat::Server
- Defined in:
- lib/backdat/server.rb
Overview
The backdat server and management daemon.
Instance Method Summary collapse
-
#initialize ⇒ Server
constructor
Creates a new backdat server.
-
#rack_options ⇒ Hash
Gets the rack options from the configuration.
-
#run ⇒ Object
Runs the server.
Constructor Details
#initialize ⇒ Server
Creates a new backdat server.
9 10 |
# File 'lib/backdat/server.rb', line 9 def initialize end |
Instance Method Details
#rack_options ⇒ Hash
Gets the rack options from the configuration.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/backdat/server.rb', line 30 def opts = Hash.new Backdat::Config.configuration.each do |k,v| if /^rack/ =~ k.to_s param = k.to_s.gsub('rack_', '') case param when "environment" opts[param.to_sym] = v else opts[param.capitalize.to_sym] = v end end end opts end |
#run ⇒ Object
Runs the server.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/backdat/server.rb', line 13 def run if Backdat::Config[:server] EM.run do @app = Rack::Builder.new do use Rack::Lint use Rack::ShowExceptions run Rack::Cascade.new([Backdat::Http]) end.to_app Rack::Handler.get(:puma).run(@app, ) end end end |