Class: CertWatch::CertbotClient

Inherits:
Client
  • Object
show all
Defined in:
lib/cert_watch/certbot_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CertbotClient

Returns a new instance of CertbotClient.



3
4
5
6
7
# File 'lib/cert_watch/certbot_client.rb', line 3

def initialize(options)
  @executable = options.fetch(:executable)
  @port = options.fetch(:port)
  @shell = options.fetch(:shell, Shell)
end

Instance Method Details

#renew(domain) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/cert_watch/certbot_client.rb', line 9

def renew(domain)
  if Rails.env.development?
    Rails.logger.info("[CertWatch] Skipping certificate renewal for #{domain} in development.")
    return
  end

  @shell.sudo(renew_command(domain))
rescue Shell::CommandFailed => e
  fail(RenewError, e.message)
end