Method: SSL#initialize

Defined in:
lib/resources/ssl.rb

#initialize(opts = {}) ⇒ SSL



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/resources/ssl.rb', line 46

def initialize(opts = {})
  @host = opts[:host]
  if @host.nil?
    # Transports like SSH and WinRM will provide a hostname
    if inspec.backend.respond_to?('hostname')
      @host = inspec.backend.hostname
    elsif inspec.backend.class.to_s == 'Train::Transports::Local::Connection'
      @host = 'localhost'
    else
      raise 'Cannot determine host for SSL test. Please specify it or use a different target.'
    end
  end
  @port = opts[:port] || 443
  @timeout = opts[:timeout]
  @retries = opts[:retries]
end