Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

OpenSSL::Config#get_value

config.get_value(section, key) → string

Gets the value of key from the given section.

Given the following configurating file being loaded:

Example
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:

Example
config.get_value('default','foo')
  #=> "bar"
See also #each #initialize_copy #[] #inspect also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0