Class: Hato::Httpd

Inherits:
Object
  • Object
show all
Defined in:
lib/hato/httpd.rb

Defined Under Namespace

Classes: App

Instance Method Summary collapse

Constructor Details

#initialize(observer, config) ⇒ Httpd

Returns a new instance of Httpd.



7
8
9
10
# File 'lib/hato/httpd.rb', line 7

def initialize(observer, config)
  @observer = observer
  @config   = config
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hato/httpd.rb', line 12

def run
  App.set(:observer,     @observer)
  App.set(:api_key,      @config.api_key)
  App.set(:logger_level, @config.log_level)

  Rack::Handler::WEBrick.run(
    App.new,
    Host: @config.host || '0.0.0.0',
    Port: @config.port || 9699,
  )
end