Class: LetsEncryptHerokuClient

Inherits:
Object
  • Object
show all
Defined in:
lib/lets_encrypt_heroku_client.rb,
lib/lets_encrypt_heroku_client/version.rb

Constant Summary collapse

VERSION =
'0.1.0'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ LetsEncryptHerokuClient

Returns a new instance of LetsEncryptHerokuClient.



4
5
6
# File 'lib/lets_encrypt_heroku_client.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/lets_encrypt_heroku_client.rb', line 8

def call(env)
  if challenge_url?(env['PATH_INFO'])
    body = ENV['LETS_ENCRYPT_CHALLENGE_FILE_CONTENT']
    headers = {
      'Content-Length' => body.length.to_s
    }

    [200, headers, [body]]
  else
    app.call(env)
  end
end