Class: Souffle::Server
- Inherits:
-
Object
- Object
- Souffle::Server
- Defined in:
- lib/souffle/server.rb
Overview
The souffle server and management daemon.
Instance Method Summary collapse
-
#initialize ⇒ Server
constructor
Creates a new souffle server.
-
#rack_options ⇒ Hash
Gets the rack options from the configuration.
-
#run ⇒ Object
Runs the server.
-
#run_instance ⇒ Object
Starts a single instance of the provisioner.
-
#run_server ⇒ Object
Starts a long-running webserver that continuously handles requests.
Constructor Details
#initialize ⇒ Server
Creates a new souffle server.
10 11 |
# File 'lib/souffle/server.rb', line 10 def initialize end |
Instance Method Details
#rack_options ⇒ Hash
Gets the rack options from the configuration.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/souffle/server.rb', line 25 def opts = Hash.new Souffle::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.
14 15 16 17 18 19 20 |
# File 'lib/souffle/server.rb', line 14 def run if Souffle::Config[:server] run_server else run_instance end end |
#run_instance ⇒ Object
Starts a single instance of the provisioner.
56 57 58 59 60 61 |
# File 'lib/souffle/server.rb', line 56 def run_instance Souffle::Log.info "Single instance runs are not currently implemented..." # system = Souffle::System.from_hash(data) # provider = Souffle::Provider.plugin(system.try_opt(:provider)).new # system_tag = provider.create_system(system) end |
#run_server ⇒ Object
Starts a long-running webserver that continuously handles requests.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/souffle/server.rb', line 43 def run_server EM.synchrony do @app = Rack::Builder.new do use Rack::Lint use Rack::ShowExceptions run Rack::Cascade.new([Souffle::Http]) end.to_app Rack::Handler.get(:thin).run(@app, ) end end |