Module: EasyRSA::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/easyrsa/config.rb

Defined Under Namespace

Classes: RequiredOptionMissing

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cityObject

Returns the value of attribute city.



8
9
10
# File 'lib/easyrsa/config.rb', line 8

def city
  @city
end

#companyObject

Returns the value of attribute company.



8
9
10
# File 'lib/easyrsa/config.rb', line 8

def company
  @company
end

#countryObject

Returns the value of attribute country.



8
9
10
# File 'lib/easyrsa/config.rb', line 8

def country
  @country
end

#emailObject

Returns the value of attribute email.



8
9
10
# File 'lib/easyrsa/config.rb', line 8

def email
  @email
end

#orgunitObject

Returns the value of attribute orgunit.



8
9
10
# File 'lib/easyrsa/config.rb', line 8

def orgunit
  @orgunit
end

#serverObject

Returns the value of attribute server.



8
9
10
# File 'lib/easyrsa/config.rb', line 8

def server
  @server
end

Instance Method Details

#from_hash(options = {}) ⇒ Object

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

Examples:

Configure easyrsa.

config.from_hash({})

Parameters:

  • options (Hash) (defaults to: {})

    The settings to use.



17
18
19
20
21
# 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) ⇒ Object

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

Examples:

Configure easyrsa.

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

Parameters:

  • path (String)

    The path to the file.



30
31
32
33
34
35
# 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