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

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