Class: LetsencryptStandalone::Domain
- Defined in:
- lib/letsencrypt_standalone/domain.rb
Constant Summary collapse
- @@default_private_key_name =
'private_key.pem'
Instance Attribute Summary collapse
-
#certificates ⇒ Object
Returns the value of attribute certificates.
-
#files ⇒ Object
Returns the value of attribute files.
-
#host ⇒ Object
Returns the value of attribute host.
-
#private_key ⇒ Object
Returns the value of attribute private_key.
-
#private_key_name ⇒ Object
readonly
Returns the value of attribute private_key_name.
-
#private_key_path ⇒ Object
readonly
Returns the value of attribute private_key_path.
Instance Method Summary collapse
- #host_dir ⇒ Object
-
#initialize(params:, path: './') ⇒ Domain
constructor
A new instance of Domain.
- #validate(client:) ⇒ Object
- #verify_status ⇒ Object
Methods inherited from Base
#endpoint_url, #logger, logger, #output_dir, #path, #ssl_subdir
Constructor Details
#initialize(params:, path: './') ⇒ Domain
Returns a new instance of Domain.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/letsencrypt_standalone/domain.rb', line 12 def initialize(params:, path: './') @host = params.fetch(:host) @private_key_name = params.fetch(:private_key, @@default_private_key_name) @private_key_path = File.join(output_dir,@host, @private_key_name) @files = params[:certificates] if params.has_key? :certificates load_certs end load_private_key end |
Instance Attribute Details
#certificates ⇒ Object
Returns the value of attribute certificates.
7 8 9 |
# File 'lib/letsencrypt_standalone/domain.rb', line 7 def certificates @certificates end |
#files ⇒ Object
Returns the value of attribute files.
7 8 9 |
# File 'lib/letsencrypt_standalone/domain.rb', line 7 def files @files end |
#host ⇒ Object
Returns the value of attribute host.
7 8 9 |
# File 'lib/letsencrypt_standalone/domain.rb', line 7 def host @host end |
#private_key ⇒ Object
Returns the value of attribute private_key.
7 8 9 |
# File 'lib/letsencrypt_standalone/domain.rb', line 7 def private_key @private_key end |
#private_key_name ⇒ Object (readonly)
Returns the value of attribute private_key_name.
8 9 10 |
# File 'lib/letsencrypt_standalone/domain.rb', line 8 def private_key_name @private_key_name end |
#private_key_path ⇒ Object (readonly)
Returns the value of attribute private_key_path.
8 9 10 |
# File 'lib/letsencrypt_standalone/domain.rb', line 8 def private_key_path @private_key_path end |
Instance Method Details
#host_dir ⇒ Object
23 24 25 |
# File 'lib/letsencrypt_standalone/domain.rb', line 23 def host_dir @host_dir ||= File.join(output_dir, host) end |
#validate(client:) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/letsencrypt_standalone/domain.rb', line 27 def validate(client:) = client.(domain: self.host) #The http-01 method will require you to respond to a HTTP request. @challenge = .http01 # Save the file. We'll create a public directory to serve it from, and inside it we'll create the challenge file. FileUtils.mkdir_p(File.join(config.www_root, File.dirname(@challenge.filename))) # We'll write the content of the file File.write(File.join(config.www_root, @challenge.filename), @challenge.file_content) # try to verify @challenge.request_verification end |
#verify_status ⇒ Object
42 43 44 |
# File 'lib/letsencrypt_standalone/domain.rb', line 42 def verify_status @challenge.verify_status end |