Class: Arnold::Controller::Web

Inherits:
Object
  • Object
show all
Defined in:
lib/arnold/controller/web.rb

Instance Method Summary collapse

Constructor Details

#initializeWeb

Returns a new instance of Web.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/arnold/controller/web.rb', line 11

def initialize
  opts = {
          :Port               => $CONFIG[:port] || 8080,
          :Logger             => WEBrick::Log::new($stderr, WEBrick::Log::DEBUG),
          :ServerType         => $CONFIG[:daemonize] ? WEBrick::Daemon : WEBrick::SimpleServer,
          :DocumentRoot       => $CONFIG[:docroot],
          :SSLEnable          => true,
          :SSLVerifyClient    => OpenSSL::SSL::VERIFY_NONE,
          :SSLCertificate     => OpenSSL::X509::Certificate.new(  File.open($CONFIG[:sslcert]).read),
          :SSLPrivateKey      => OpenSSL::PKey::RSA.new(          File.open($CONFIG[:sslkey]).read),
          :SSLCertName        => [ [ "CN",WEBrick::Utils::getservername ] ]
  }

  # now it's off to the races!
  Rack::Handler::WEBrick.run(Arnold::Server, opts) do |server|
    [:INT, :TERM].each { |sig| trap(sig) { server.stop } }
  end
end