module MockCodeManager::WEBrick

Public Class Methods

run!() click to toggle source
# File lib/mock_code_manager.rb, line 151
def self.run!
  system("#{RES_DIR}/setup_ssl.sh")

  # note - we obtain the fqdn by shelling out rather then doing tricks in ruby
  # this is for consistency with the openssl calls we already made to generate
  fqdn = %x(hostname -f).strip

  webrick_options = {
      :Host                 => "0.0.0.0",
      :Port                 => 8170,
      :Logger               => ::WEBrick::Log::new($stdout, ::WEBrick::Log::DEBUG),
      :SSLEnable            => true,
      :force_ssl            => true,
      :SSLCACertificateFile => "#{SSL_DIR}/certs/ca.pem",
      :SSLCertificate       => OpenSSL::X509::Certificate.new(  File.open("#{SSL_DIR}/certs/server.pem").read),
      :SSLPrivateKey        => OpenSSL::PKey::RSA.new(          File.open("#{SSL_DIR}/private_keys/server.pem").read),
      :SSLCertName          => [ [ "CN", fqdn] ]
  }

  Rack::Handler::WEBrick.run MockCodeManager, webrick_options
end