Skip to content

Commit

Permalink
Switch Settings.dig to dot notation (#19099)
Browse files Browse the repository at this point in the history
* switch Settings.dig to dot notation

* fix linting warning

* add nod_vanotify_status_callback and pension_ipf_vanotify_status_callback bearer_tokens to setting.yml
  • Loading branch information
stevenjcumming authored Nov 1, 2024
1 parent 2e929be commit 4924b69
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/controllers/v1/nod_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def authenticity_error
end

def bearer_token_secret
Settings.dig(:nod_vanotify_status_callback, :bearer_token)
Settings.nod_vanotify_status_callback.bearer_token
end

def enabled?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v1/pension_ipf_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def authenticity_error
end

def bearer_token_secret
Settings.dig(:pension_ipf_vanotify_status_callback, :bearer_token)
Settings.pension_ipf_vanotify_status_callback.bearer_token
end

def log_params(payload)
Expand Down
6 changes: 6 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1751,6 +1751,12 @@ brd:
api_key: 'fake_key'
base_name: 'https://something.fake.va.gov'

nod_vanotify_status_callback:
bearer_token: bearer_token_secret

pension_ipf_vanotify_status_callback:
bearer_token: bearer_token_secret

travel_pay:
sts:
service_account_id: ~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def validate_json_schema

def token_validation_api_key
# FIXME: rename token storage key
Settings.dig(:modules_appeals_api, :token_validation, :contestable_issues, :api_key)
Settings.modules_appeals_api.token_validation.contestable_issues.api_key
end

def get_caseflow_response
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def render_model_errors(hlr)
end

def token_validation_api_key
Settings.dig(:modules_appeals_api, :token_validation, :higher_level_reviews, :api_key)
Settings.modules_appeals_api.token_validation.higher_level_reviews.api_key
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_caseflow_response
end

def token_validation_api_key
Settings.dig(:modules_appeals_api, :token_validation, :legacy_appeals, :api_key)
Settings.modules_appeals_api.token_validation.legacy_appeals.api_key
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def validate_token_nod_access!(nod_id)
end

def token_validation_api_key
Settings.dig(:modules_appeals_api, :token_validation, :notice_of_disagreements, :api_key)
Settings.modules_appeals_api.token_validation.notice_of_disagreements.api_key
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def request_headers
end

def token_validation_api_key
Settings.dig(:modules_appeals_api, :token_validation, :notice_of_disagreements, :api_key)
Settings.modules_appeals_api.token_validation.notice_of_disagreements.api_key
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def validate_token_sc_access!(sc_id)
end

def token_validation_api_key
Settings.dig(:modules_appeals_api, :token_validation, :supplemental_claims, :api_key)
Settings.modules_appeals_api.token_validation.supplemental_claims.api_key
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def render_model_errors(model)
end

def token_validation_api_key
Settings.dig(:modules_appeals_api, :token_validation, :supplemental_claims, :api_key)
Settings.modules_appeals_api.token_validation.supplemental_claims.api_key
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_caseflow_response
end

def token_validation_api_key
Settings.dig(:modules_appeals_api, :token_validation, :appeals_status, :api_key)
Settings.modules_appeals_api.token_validation.appeals_status.api_key
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def token_validation_result
private

def unsafe_mode?
Rails.env.development? && Settings.dig(:modules_appeals_api, :enable_unsafe_mode)
Rails.env.development? && Settings.modules_appeals_api.enable_unsafe_mode
end

# Override this in individual controllers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def perform
private

def enrollment_upload_enabled?
Settings.dig('covid_vaccine', 'enrollment_service', 'job_enabled')
Settings.covid_vaccine.enrollment_service.job_enabled
end

def handle_errors(ex)
Expand Down

0 comments on commit 4924b69

Please sign in to comment.