Sha256: 6978517cddf1e3eec73e869e274a77cf63aa5c11936f926f14711953c29677d5

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

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] }
    {
      Port: port,
      Host: "0.0.0.0",
      AccessLog: [],
      SSLCertificate: certificate,
      SSLPrivateKey: OpenSSL::PKey::RSA.new(File.read(SSL_KEY)),
      SSLEnable: true,
      SSLCertName: cert_name
    }
  end

  require "pact_broker"

  DATABASE_CREDENTIALS = { adapter: "sqlite", database: "/tmp/pact_broker_ssl_database.sqlite3", :encoding => "utf8" }

  app = PactBroker::App.new do | config |
    config.logger = ::Logger.new($stdout)
    config.logger.level = ::Logger::INFO
    config.auto_migrate_db = true
    config.database_connection = Sequel.connect(DATABASE_CREDENTIALS.merge(:logger => PactBroker::DB::LogQuietener.new(Logger.new(StringIO.new))))
  end

  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

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/support/ssl_pact_broker_server.rb
pact_broker-2.89.0 spec/support/ssl_pact_broker_server.rb
pact_broker-2.88.0 spec/support/ssl_pact_broker_server.rb
pact_broker-2.87.0 spec/support/ssl_pact_broker_server.rb
pact_broker-2.86.0 spec/support/ssl_pact_broker_server.rb
pact_broker-2.85.1 spec/support/ssl_pact_broker_server.rb
pact_broker-2.85.0 spec/support/ssl_pact_broker_server.rb
pact_broker-2.84.0 spec/support/ssl_pact_broker_server.rb
pact_broker-2.83.0 spec/support/ssl_pact_broker_server.rb
pact_broker-2.82.0 spec/support/ssl_pact_broker_server.rb
pact_broker-2.81.0 spec/support/ssl_pact_broker_server.rb
pact_broker-2.80.0 spec/support/ssl_pact_broker_server.rb