Skip to content

Commit

Permalink
[DR-74493] fix pdf validation config in prod (#16067)
Browse files Browse the repository at this point in the history
* use Benefits Intake API key in production; default to DR API key in lower environments as originally designed

* rubocop nits
  • Loading branch information
anniebtran authored Mar 26, 2024
1 parent 5761817 commit 76a84f6
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/decision_review/utilities/pdf_validation/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module DecisionReview
module PdfValidation
class Configuration < DecisionReview::Configuration
##
# @return [String] Base path for decision review URLs.
# @return [String] Base path for PDF validation URL.
#
def base_path
Settings.decision_review.pdf_validation.url
Expand All @@ -17,6 +17,19 @@ def service_name
'DecisionReview::PDFValidation'
end

##
# @return [Hash] The basic headers required for any decision review API call.
#
def self.base_request_headers
# Can use regular Decision Reviews API key in lower environments
return super unless Rails.env.production?

# Since we're using the `uploads/validate_document` endpoint under Benefits Intake API,
# we need to use their API key. This is pulled from BenefitsIntakeService::Configuration
api_key = Settings.benefits_intake_service.api_key || Settings.form526_backup.api_key
super.merge('apiKey' => api_key)
end

##
# Creates the a connection with parsing json and adding breakers functionality.
#
Expand Down

0 comments on commit 76a84f6

Please sign in to comment.