Class: Pechkin::Command::RunServer

Inherits:
Base
  • Object
show all
Defined in:
lib/pechkin/command/run_server.rb

Overview

Start pechkin HTTP server

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#configuration, #handler, #initialize, #puts, #warn

Constructor Details

This class inherits a constructor from Pechkin::Command::Base

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pechkin/command/run_server.rb', line 11

def execute
  # Configure Puma server instead config.ru
  puma_config = Puma::Configuration.new do |user_config|
    user_config.bind "tcp://#{options.bind_address}:#{options.port}"
    user_config.threads options.min_threads, options.max_threads # Set max and min threads
    user_config.app AppBuilder.new.build(handler, options)
  end

  # Run Puma server with configuration
  launcher = Puma::Launcher.new(puma_config)
  launcher.run
end

#matches?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/pechkin/command/run_server.rb', line 7

def matches?
  true # Always match
end