class SSLTest::Config

Loads and interprets the configuration file.

Constants

DEFAULT

Attributes

certs[R]
raw[R]

Public Class Methods

load_conf(opts) click to toggle source
# File lib/ssl_test/config.rb, line 10
def self.load_conf(opts)
  Config.new(opts)
end
new(opts) click to toggle source

TODO: do some basic type validation on the config file.

# File lib/ssl_test/config.rb, line 15
def initialize(opts)
  @opts = opts

  @raw = YAML.load_file(@opts[:config])
  @certs = @raw['certs']
end

Public Instance Methods

action() click to toggle source
# File lib/ssl_test/config.rb, line 54
def action
  @opts[:action]
end
hosttotest() click to toggle source
# File lib/ssl_test/config.rb, line 26
def hosttotest
  @raw['hostname']
end
listener_port() click to toggle source
# File lib/ssl_test/config.rb, line 30
def listener_port
  @raw['listener_port']
end
logfile() click to toggle source
# File lib/ssl_test/config.rb, line 69
def logfile
  if @opts[:logfile] == '-'
    STDOUT
  else
    @opts[:logfile]
  end
end
loglevel() click to toggle source
# File lib/ssl_test/config.rb, line 58
def loglevel
  levelstr = if @opts.has_key? :loglevel
    @opts[:loglevel].upcase
  elsif @raw.has_key? 'log' and @raw['log'].has_key? 'level'
    @raw['log']['level'].upcase
  else
    'INFO'
  end
  Logger.const_get(levelstr)
end
packetthief() click to toggle source
# File lib/ssl_test/config.rb, line 38
def packetthief
  pt = @raw['packetthief'].dup
  newvals = {}
  pt.each_pair do |k,v|
    if k.kind_of? String
      newvals[k.to_sym] = v
    end
  end
  pt.merge! newvals
  pt
end
pause?() click to toggle source
# File lib/ssl_test/config.rb, line 50
def pause?
  @opts[:pause]
end
testing_method() click to toggle source
# File lib/ssl_test/config.rb, line 34
def testing_method
  @raw['testing_method']
end
tests() click to toggle source
# File lib/ssl_test/config.rb, line 22
def tests
  @raw['tests']
end