Class: LetsEncrypt::Redis

Inherits:
Object
  • Object
show all
Defined in:
lib/letsencrypt/redis.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.connectionObject



7
8
9
# File 'lib/letsencrypt/redis.rb', line 7

def connection
  @connection ||= ::Redis.new(url: LetsEncrypt.config.redis_url)
end

.delete(cert) ⇒ Object

Delete certificate from redis.



20
21
22
23
24
25
# File 'lib/letsencrypt/redis.rb', line 20

def delete(cert)
  return unless cert.key.present? && cert.certificate.present?
  LetsEncrypt.logger.info "Delete #{cert.domain}'s certificate from redis"
  connection.del "#{cert.domain}.key"
  connection.del "#{cert.domain}.crt"
end

.save(cert) ⇒ Object

Save certificate into redis.



12
13
14
15
16
17
# File 'lib/letsencrypt/redis.rb', line 12

def save(cert)
  return unless cert.key.present? && cert.bundle.present?
  LetsEncrypt.logger.info "Save #{cert.domain}'s certificate (bundle) to redis"
  connection.set "#{cert.domain}.key", cert.key
  connection.set "#{cert.domain}.crt", cert.bundle
end