Method: VCAP::Component.start_http_server

Defined in:
lib/vcap/component.rb

.start_http_server(host, port, auth, logger) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/vcap/component.rb', line 131

def start_http_server(host, port, auth, logger)
  http_server = Thin::Server.new(host, port, :signals => false) do
    Thin::Logging.silent = true
    use Rack::Auth::Basic do |username, password|
      [username, password] == auth
    end
    map '/healthz' do
      run Healthz.new(logger)
    end
    map '/varz' do
      run Varz.new(logger)
    end
  end
  http_server.start!
end