SHARE
TWEET

Untitled

a guest Jan 22nd, 2018 120 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'webrick/ssl'
  2.  
  3. module Sinatra
  4.   class Application
  5.     def self.run!
  6.       certificate_content = File.open(ssl_certificate).read
  7.       key_content = File.open(ssl_key).read
  8.  
  9.       server_options = {
  10.         :Host => bind,
  11.         :Port => port,
  12.         :SSLEnable => true,
  13.         :SSLCertificate => OpenSSL::X509::Certificate.new(certificate_content),
  14.         # 123456 is the Private Key Password
  15.         :SSLPrivateKey => OpenSSL::PKey::RSA.new(key_content,"123456")
  16.       }
  17.  
  18.       Rack::Handler::WEBrick.run self, server_options do |server|
  19.         [:INT, :TERM].each { |sig| trap(sig) { server.stop } }
  20.         server.threaded = settings.threaded if server.respond_to? :threaded=
  21.         set :running, true
  22.       end
  23.     end
  24.   end
  25. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top