Class: LetsencryptHeroku::Process::SetupClient

Inherits:
Object
  • Object
show all
Includes:
Tools
Defined in:
lib/letsencrypt_heroku/process/setup_client.rb

Constant Summary collapse

PRODUCTION =
'https://acme-v01.api.letsencrypt.org/'
STAGING =
'https://acme-staging.api.letsencrypt.org/'

Instance Method Summary collapse

Methods included from Tools

#banner, #error, #execute, #log, #output

Instance Method Details

#build_clientObject



15
16
17
# File 'lib/letsencrypt_heroku/process/setup_client.rb', line 15

def build_client
  Acme::Client.new(private_key: private_key, endpoint: PRODUCTION)
end

#perform(context) ⇒ Object



8
9
10
11
12
13
# File 'lib/letsencrypt_heroku/process/setup_client.rb', line 8

def perform(context)
  output 'Contact letsencrypt server' do
    context.client = build_client
    context.client.register(contact: "mailto:#{context.config.contact}").agree_terms or error('registration failed')
  end
end

#private_keyObject



19
20
21
# File 'lib/letsencrypt_heroku/process/setup_client.rb', line 19

def private_key
  OpenSSL::PKey::RSA.new(4096)
end