class Armada::Connection::Docker

Attributes

connection[R]

Public Class Methods

new(host, gateway_host = nil, gateway_user = nil) click to toggle source
Calls superclass method
# File lib/armada/connection/docker.rb, line 6
def initialize(host, gateway_host = nil, gateway_user = nil)
  super(host, nil, gateway_host, gateway_user)
  @connection = create_connection
end

Public Instance Methods

to_s() click to toggle source
# File lib/armada/connection/docker.rb, line 11
def to_s
  "#{@host}:#{@port}"
end

Private Instance Methods

connection_opts() click to toggle source
# File lib/armada/connection/docker.rb, line 25
def connection_opts
  opts = {}
  if cert_path = ENV['DOCKER_CERT_PATH']
    opts[:client_cert] = File.join(cert_path, 'cert.pem')
    opts[:client_key] = File.join(cert_path, 'key.pem')
    opts[:ssl_ca_file] = File.join(cert_path, 'ca.pem')
    opts[:ssl_verify_peer] = @gateway ? false : ENV['DOCKER_TLS_VERIFY'] == '1'
  end

  opts
end
create_connection() click to toggle source
# File lib/armada/connection/docker.rb, line 16
def create_connection
  return ::Docker::Connection.new("#{scheme}://localhost:#{@tunneled_port}", connection_opts) if @gateway
  return ::Docker::Connection.new("#{scheme}://#{@host}:#{@port}", connection_opts)
end
scheme() click to toggle source
# File lib/armada/connection/docker.rb, line 21
def scheme
  ENV['DOCKER_CERT_PATH'] ? 'https' : 'http'
end