Skip to content

Instantly share code, notes, and snippets.

@danajp
Created May 23, 2017 18:48
Show Gist options
  • Save danajp/b8e74036ed2947d935daf625fcd40379 to your computer and use it in GitHub Desktop.
Save danajp/b8e74036ed2947d935daf625fcd40379 to your computer and use it in GitHub Desktop.
[net http blog] irb net http minikube
irb(main):116:0> cert_store = OpenSSL::X509::Store.new
=> #<OpenSSL::X509::Store:0x00560ede1504f8 @verify_callback=nil, @error=nil, @error_string=nil, @chain=nil, @time=nil>
irb(main):117:0> cert_store.add_file("/home/dana/.minikube/ca.crt")
=> #<OpenSSL::X509::Store:0x00560ede1504f8 @verify_callback=nil, @error=nil, @error_string=nil, @chain=nil, @time=nil>
irb(main):118:0>
irb(main):119:0* Net::HTTP.start(
irb(main):120:1* "192.168.99.100",
irb(main):121:1* 8443,
irb(main):122:1* :use_ssl => true,
irb(main):123:1* :cert_store => cert_store,
irb(main):124:1* :cert => OpenSSL::X509::Certificate.new(File.read("/home/dana/.minikube/apiserver.crt")),
irb(main):125:1* :key => OpenSSL::PKey.read(File.read("/home/dana/.minikube/apiserver.key")),
irb(main):126:1* ) do |http|
irb(main):127:1* http.request(Net::HTTP::Get.new("/version"))
irb(main):128:1> end
=> #<Net::HTTPOK 200 OK readbody=true>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment