Class: Nonnative::HTTPServer
- Inherits:
-
Server
- Object
- Server
- Nonnative::HTTPServer
- Defined in:
- lib/nonnative/http_server.rb
Overview
Puma-based HTTP server runner.
This is a convenience server implementation for running a Rack/Sinatra application in-process
under Nonnative's server lifecycle. It binds to the configured server host and first ports entry.
The server is started and stopped by Server via #perform_start / #perform_stop.
YAML configuration uses the same concrete subclass name in its class field.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(app, service) ⇒ HTTPServer
constructor
Creates a Puma server for the given Rack app and runner configuration.
Constructor Details
#initialize(app, service) ⇒ HTTPServer
Creates a Puma server for the given Rack app and runner configuration.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/nonnative/http_server.rb', line 41 def initialize(app, service) # Keep the log IO so the server lifecycle can release Puma's file handle on stop. @log = File.open(service.log, 'a') = { log_writer: Puma::LogWriter.new(log, log), force_shutdown_after: service.timeout } @server = Puma::Server.new(app, Puma::Events.new, ) super(service) end |