class Acmesmith::ChallengeResponders::HttpPath

Public Class Methods

new(config) click to toggle source
# File lib/acmesmith/challenge_responders/http_path.rb, line 11
def initialize(config)
  @config = config
end

Public Instance Methods

cleanup(domain, challenge) click to toggle source
# File lib/acmesmith/challenge_responders/http_path.rb, line 21
def cleanup(domain, challenge)
  puts "=> Cleanup challenge http-01 for #{domain} in #{self.class.name}"
  FileUtils.rm_r( File.join( htdocs_path(domain), File.dirname( challenge.filename ) ) )
end
htdocs_path(domain) click to toggle source
# File lib/acmesmith/challenge_responders/http_path.rb, line 26
def htdocs_path(domain)
  begin
    htdocs_path = @config[domain.to_sym]['htdocs_path']
  rescue
    raise "cannot read configuration for http_path"
  end

  htdocs_path
end
respond(domain, challenge) click to toggle source
# File lib/acmesmith/challenge_responders/http_path.rb, line 15
def respond(domain, challenge)
  puts "=> Responding challenge http-01 for #{domain} in #{self.class.name}"
  FileUtils.mkdir_p( File.join( htdocs_path(domain), File.dirname( challenge.filename ) ) )
  File.write( File.join( htdocs_path(domain), challenge.filename), challenge.file_content )
end
support?(type) click to toggle source
# File lib/acmesmith/challenge_responders/http_path.rb, line 7
def support?(type)
  type == 'http-01'
end