Module: MockCodeManager::WEBrick

Defined in:
lib/mock_code_manager.rb

Class Method Summary collapse

Class Method Details

.run!Object



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# 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