Method: OpenSSL::Config#get_value

Defined in:
lib/jopenssl19/openssl/config.rb,
lib/jopenssl22/openssl/config.rb,
lib/jopenssl23/openssl/config.rb

#get_value(section, key) ⇒ Object

Gets the value of key from the given section

Given the following configurating file being loaded:

config = OpenSSL::Config.load('foo.cnf')
  #=> #<OpenSSL::Config sections=["default"]>
puts config.to_s
  #=> [ default ]
  #   foo=bar

You can get a specific value from the config if you know the section and key like so:

config.get_value('default','foo')
  #=> "bar"


273
274
275
276
277
278
279
# File 'lib/jopenssl19/openssl/config.rb', line 273

def get_value(section, key)
  if section.nil?
    raise TypeError.new('nil not allowed')
  end
  section = 'default' if section.empty?
  get_key_string(section, key)
end