Module: EasyRSA::Config
Defined Under Namespace
Classes: RequiredOptionMissing
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#company ⇒ Object
Returns the value of attribute company.
-
#country ⇒ Object
Returns the value of attribute country.
-
#email ⇒ Object
Returns the value of attribute email.
-
#orgunit ⇒ Object
Returns the value of attribute orgunit.
-
#server ⇒ Object
Returns the value of attribute server.
Instance Method Summary collapse
-
#from_hash(options = {}) ⇒ Object
Configure easyrsa from a hash.
-
#load!(path) ⇒ Object
Load the settings from a compliant easyrsa.yml file.
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
8 9 10 |
# File 'lib/easyrsa/config.rb', line 8 def city @city end |
#company ⇒ Object
Returns the value of attribute company.
8 9 10 |
# File 'lib/easyrsa/config.rb', line 8 def company @company end |
#country ⇒ Object
Returns the value of attribute country.
8 9 10 |
# File 'lib/easyrsa/config.rb', line 8 def country @country end |
#email ⇒ Object
Returns the value of attribute email.
8 9 10 |
# File 'lib/easyrsa/config.rb', line 8 def email @email end |
#orgunit ⇒ Object
Returns the value of attribute orgunit.
8 9 10 |
# File 'lib/easyrsa/config.rb', line 8 def orgunit @orgunit end |
#server ⇒ Object
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.
17 18 19 20 21 |
# File 'lib/easyrsa/config.rb', line 17 def from_hash( = {}) .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.
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 |