Skip to content

Commit

Permalink
use Benefits Intake API key in production; default to DR API key in l…
Browse files Browse the repository at this point in the history
…ower environments as originally designed
  • Loading branch information
anniebtran committed Mar 25, 2024
1 parent 2e24c78 commit 6cd097c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 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,18 @@ 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 6cd097c

Please sign in to comment.