Class: CertBot::Configuration

Inherits:
RubyUtils::Configuration::BaseConfigurationRepository
  • Object
show all
Defined in:
lib/cert_bot/configuration.rb

Overview

Simple data class to store the json parameter

Instance Method Summary collapse

Instance Method Details

#check_config_keysObject (private)

method to check if the required keys are available in the json hash and check for optional ones

Raises:

  • KeyError if a given key is missing in the config hash



13
14
15
16
17
18
19
20
21
# File 'lib/cert_bot/configuration.rb', line 13

def check_config_keys
  required_config_key_available?("address")
  required_config_key_available?("port")
  required_config_key_available?("helo")
  required_config_key_available?("from")
  required_config_key_available?("to")
  determine_authtype
  determine_tls_veryfication
end

#determine_authtypeObject (private)

method to determine if the authtype is set and set its value based on the input



24
25
26
27
28
29
30
31
# File 'lib/cert_bot/configuration.rb', line 24

def determine_authtype
  case @config_hash["authtype"]
    when "login" then @config_hash["authtype"] = :login
    when "md5" then @config_hash["authtype"] = :cram_md5
  else 
    @config_hash["authtype"] = :plain
  end
end

#determine_tls_veryficationObject (private)

method to determine if the tls flag is set and set its value based on the input



34
35
36
37
38
39
40
# File 'lib/cert_bot/configuration.rb', line 34

def determine_tls_veryfication
  case @config_hash["tls_verify"]
    when "false" then @config_hash["tls_verify"] = false
  else 
    @config_hash["tls_verify"] = true
  end
end