summaryrefslogtreecommitdiff
path: root/app/controllers/acme_challenges_controller.rb
blob: 4a7706db94e6b06074eb51382fb8e955b1f328e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

# rubocop:disable Rails/ApplicationController
class AcmeChallengesController < ActionController::Base
  def show
    if acme_order
      render plain: acme_order.challenge_file_content, content_type: 'text/plain'
    else
      head :not_found
    end
  end

  private

  def acme_order
    @acme_order ||= PagesDomainAcmeOrder.find_by_domain_and_token(params[:domain], params[:token])
  end
end
# rubocop:enable Rails/ApplicationController