module EasyRSA::Config

Attributes

city[RW]
company[RW]
country[RW]
email[RW]
name[RW]
orgunit[RW]
server[RW]
state[RW]

Public Instance Methods

from_hash(options = {}) click to toggle source

Configure easyrsa from a hash. This is usually called after parsing a yaml config file such as easyrsa.yaml.

@example Configure easyrsa.

config.from_hash({})

@param [ Hash ] options The settings to use.

# File lib/easyrsa/config.rb, line 17
def from_hash(options = {})
  options.each_pair do |name, value|
    send("#{name}=", value) if respond_to?("#{name}=")
  end
end
load!(path) click to toggle source

Load the settings from a compliant easyrsa.yml file. This can be used for easy setup with frameworks other than Rails.

@example Configure easyrsa.

easyrsa.load!("/path/to/easyrsa.yml")

@param [ String ] path The path to the file.

# File lib/easyrsa/config.rb, line 30
def load!(path)
  settings = YAML.load(ERB.new(File.new(path).read).result)
  if settings.present?
    from_hash(settings)
  end
end