Sha256: 8e1008e72a30d5410ea2bb55d903c0ca42a310731060f126ab04c43d6799d79e

Contents?: true

Size: 965 Bytes

Versions: 49

Compression:

Stored size: 965 Bytes

Contents

if __FILE__ == $0

  SSL_KEY = 'spec/fixtures/certificates/key.pem'
  SSL_CERT = 'spec/fixtures/certificates/cert.pem'

  trap(:INT) do
    @server.shutdown
    exit
  end

  def webrick_opts port
    certificate = OpenSSL::X509::Certificate.new(File.read(SSL_CERT))
    cert_name = certificate.subject.to_a.collect{|a| a[0..1] }
    logger_stream = ENV['DEBUG'] ? $stderr : StringIO.new
    {
      Port: port,
      Host: "0.0.0.0",
      AccessLog: [],
      Logger: WEBrick::Log.new(logger_stream,WEBrick::Log::INFO),
      SSLCertificate: certificate,
      SSLPrivateKey: OpenSSL::PKey::RSA.new(File.read(SSL_KEY)),
      SSLEnable: true,
      SSLCertName: cert_name
    }
  end

  app = ->(env) { puts "hello"; [200, {}, ['Hello world' + "\n"]] }

  require 'webrick'
  require 'webrick/https'
  require 'rack'
  require 'rack/handler/webrick'

  opts = webrick_opts(4444)

  Rack::Handler::WEBrick.run(app, opts) do |server|
    @server = server
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
pact_broker-2.79.1 spec/support/ssl_webhook_server.rb
pact_broker-2.79.0 spec/support/ssl_webhook_server.rb
pact_broker-2.78.1 spec/support/ssl_webhook_server.rb
pact_broker-2.78.0 spec/support/ssl_webhook_server.rb
pact_broker-2.77.0 spec/support/ssl_webhook_server.rb
pact_broker-2.76.2 spec/support/ssl_webhook_server.rb
pact_broker-2.76.1 spec/support/ssl_webhook_server.rb
pact_broker-2.76.0 spec/support/ssl_webhook_server.rb
pact_broker-2.75.0 spec/support/ssl_webhook_server.rb
pact_broker-2.74.1 spec/support/ssl_webhook_server.rb
pact_broker-2.74.0 spec/support/ssl_webhook_server.rb
pact_broker-2.73.0 spec/support/ssl_webhook_server.rb
pact_broker-2.72.0 spec/support/ssl_webhook_server.rb
pact_broker-2.71.0 spec/support/ssl_webhook_server.rb
pact_broker-2.70.0 spec/support/ssl_webhook_server.rb
pact_broker-2.69.0 spec/support/ssl_webhook_server.rb
pact_broker-2.68.1 spec/support/ssl_webhook_server.rb
pact_broker-2.68.0 spec/support/ssl_webhook_server.rb
pact_broker-2.67.0 spec/support/ssl_webhook_server.rb
pact_broker-2.66.0 spec/support/ssl_webhook_server.rb