Sha256: 1fdc9e67d4862cbb7cb135f227ae2615610dbf62adaadb2eb3efacbb228998e8

Contents?: true

Size: 1.09 KB

Versions: 88

Compression:

Stored size: 1.09 KB

Contents

if __FILE__ == $0
  require 'pact_broker'

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

  app = PactBroker::App.new do | config |
    config.logger = ::Logger.new($stdout)
    config.logger.level = ::Logger::DEBUG
    config.database_connection = Sequel.connect(DATABASE_CREDENTIALS)
  end

  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 '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

88 entries across 88 versions & 1 rubygems

Version Path
pact_broker-2.79.1 script/run-with-ssl.rb
pact_broker-2.79.0 script/run-with-ssl.rb
pact_broker-2.78.1 script/run-with-ssl.rb
pact_broker-2.78.0 script/run-with-ssl.rb
pact_broker-2.77.0 script/run-with-ssl.rb
pact_broker-2.76.2 script/run-with-ssl.rb
pact_broker-2.76.1 script/run-with-ssl.rb
pact_broker-2.76.0 script/run-with-ssl.rb
pact_broker-2.75.0 script/run-with-ssl.rb
pact_broker-2.74.1 script/run-with-ssl.rb
pact_broker-2.74.0 script/run-with-ssl.rb
pact_broker-2.73.0 script/run-with-ssl.rb
pact_broker-2.72.0 script/run-with-ssl.rb
pact_broker-2.71.0 script/run-with-ssl.rb
pact_broker-2.70.0 script/run-with-ssl.rb
pact_broker-2.69.0 script/run-with-ssl.rb
pact_broker-2.68.1 script/run-with-ssl.rb
pact_broker-2.68.0 script/run-with-ssl.rb
pact_broker-2.67.0 script/run-with-ssl.rb
pact_broker-2.66.0 script/run-with-ssl.rb