Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gem to not use any Rails specific code #15

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/letsencrypt-rails-heroku/letsencrypt.rb
Expand Up @@ -9,9 +9,9 @@ def self.configure
end

def self.challenge_configured?
configuration.acme_challenge_filename.present? &&
configuration.acme_challenge_filename.starts_with?(".well-known/") &&
configuration.acme_challenge_file_content.present?
configuration.acme_challenge_filename != nil &&
configuration.acme_challenge_filename.start_with?(".well-known/") &&
configuration.acme_challenge_file_content != nil
end

class Configuration
Expand All @@ -25,14 +25,14 @@ def initialize
@heroku_app = ENV["HEROKU_APP"]
@acme_email = ENV["ACME_EMAIL"]
@acme_domain = ENV["ACME_DOMAIN"]
@acme_endpoint = ENV["ACME_ENDPOINT"].presence || 'https://acme-v01.api.letsencrypt.org/'
@acme_endpoint = (ENV["ACME_ENDPOINT"] != nil ? ENV["ACME_ENDPOINT"] : nil) || 'https://acme-v01.api.letsencrypt.org/'
@acme_challenge_filename = ENV["ACME_CHALLENGE_FILENAME"]
@acme_challenge_file_content = ENV["ACME_CHALLENGE_FILE_CONTENT"]
end

def valid?
heroku_token.present? && heroku_app.present? && acme_email.present? &&
acme_domain.present?
heroku_token != nil && heroku_app != nil && acme_email != nil &&
acme_domain != nil
end
end
end
2 changes: 1 addition & 1 deletion lib/tasks/letsencrypt.rake
Expand Up @@ -6,7 +6,7 @@ require 'platform-api'
namespace :letsencrypt do

desc 'Renew your LetsEncrypt certificate'
task :renew => :environment do
task :renew do
# Check configuration looks OK
abort "letsencrypt-rails-heroku is configured incorrectly. Are you missing an environment variable or other configuration? You should have a heroku_token, heroku_app, acmp_email and acme_domain configured either via a `Letsencrypt.configure` block in an initializer or as environment variables." unless Letsencrypt.configuration.valid?

Expand Down