Learn how to securely route Ruby HTTP traffic through a QuotaGuard Shield proxy using the RestClient library.
Ruby installed.
QUOTAGUARDSHIELD_URL=... bin/qgpass ruby restclient.rbBe sure to set QUOTAGUARDSHIELD_URL to your Connection URL from the QuotaGuard Dashboard.
docker build -t qg-shield-ruby-restclient-example .
docker run -e QUOTAGUARDSHIELD_URL=... qg-shield-ruby-restclient-example#!/usr/bin/env ruby
require 'rest-client'
require 'uri'
# Use localhost and port 8080 for qgpass
quotaguard = URI.parse("http://localhost:8080")
RestClient.proxy = "http://#{quotaguard.host}:#{quotaguard.port}"
result = RestClient.get('https://ip.quotaguard.com')
puts result.bodyFROM ruby:latest
WORKDIR /app/
RUN gem install rest-client
# Download and extract qgpass
RUN curl https://s3.amazonaws.com/quotaguard/qgpass-latest.tar.gz | tar xz -C /app/
COPY restclient.rb restclient.rb
ENTRYPOINT [ "/app/bin/qgpass", "ruby", "restclient.rb" ]