Module: MockCodeManager::WEBrick

Defined in:
lib/mock_code_manager.rb

Class Method Summary collapse

Class Method Details

.run!Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mock_code_manager.rb', line 70

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