Class: Cuboid::Rest::Server
- Extended by:
- UI::Output
- Defined in:
- lib/cuboid/rest/server.rb,
lib/cuboid/rest/server/routes/grid.rb,
lib/cuboid/rest/server/routes/agent.rb,
lib/cuboid/rest/server/instance_helpers.rb,
lib/cuboid/rest/server/routes/instances.rb,
lib/cuboid/rest/server/routes/scheduler.rb
Defined Under Namespace
Modules: InstanceHelpers, Routes
Class Method Summary collapse
Methods included from UI::Output
error_buffer, initialize, log_error, output_provider_file, print_bad, print_debug, print_error, print_info, print_line, print_ok, print_status, print_verbose, reroute_to_file, reroute_to_file?
Methods included from UI::OutputInterface
Methods included from UI::OutputInterface::Personalization
Methods included from UI::OutputInterface::Controls
#debug?, #debug_level, #debug_level_1?, #debug_level_2?, #debug_level_3?, #debug_level_4?, #debug_off, #debug_on, initialize, #verbose?, #verbose_off, #verbose_on
Methods included from UI::OutputInterface::ErrorLogging
#error_logfile, #has_error_log?, initialize, #set_error_logfile
Methods included from UI::OutputInterface::Implemented
#print_debug_backtrace, #print_debug_exception, #print_debug_level_1, #print_debug_level_2, #print_debug_level_3, #print_debug_level_4, #print_error_backtrace, #print_exception
Methods included from UI::OutputInterface::Abstract
#output_provider_file, #print_bad, #print_debug, #print_error, #print_info, #print_line, #print_ok, #print_status, #print_verbose
Class Method Details
.reset ⇒ Object
137 138 139 140 |
# File 'lib/cuboid/rest/server.rb', line 137 def reset @@instances.clear @@agents.clear end |
.run!(options) ⇒ Object
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/cuboid/rest/server.rb', line 142 def run!( ) set :username, [:username] set :password, [:password] server = Puma::Server.new( self ) ssl = false if (tls = [:tls]) && tls[:private_key] && tls[:certificate] ctx = Puma::MiniSSL::Context.new ctx.key = tls[:private_key] ctx.cert = tls[:certificate] if tls[:ca] puts 'CA provided, peer verification has been enabled.' ctx.ca = tls[:ca] ctx.verify_mode = Puma::MiniSSL::VERIFY_PEER | Puma::MiniSSL::VERIFY_FAIL_IF_NO_PEER_CERT else puts 'CA missing, peer verification has been disabled.' end ssl = true server.binder.add_ssl_listener( [:bind], [:port], ctx ) else ssl = false server.add_tcp_listener( [:bind], [:port] ) end puts "Listening on http#{'s' if ssl}://#{[:bind]}:#{[:port]}" begin server.run.join rescue Interrupt server.stop( true ) end end |