Skip to content

Commit

Permalink
Update all references to deprecated Rails.applications.secrets to Rai…
Browse files Browse the repository at this point in the history
…ls.application.credentials
  • Loading branch information
KludgeKML committed Oct 31, 2023
1 parent d5acefe commit a064968
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/controllers/webhooks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def link_check_callback
private

def verify_signature
return unless Rails.application.secrets.link_checker_api_secret_token
return unless Rails.application.credentials.link_checker_api_secret_token

given_signature = request.headers["X-LinkCheckerApi-Signature"]
return head :bad_request unless given_signature
Expand All @@ -28,6 +28,6 @@ def verify_signature
end

def webhook_secret_token
Rails.application.secrets.link_checker_api_secret_token
Rails.application.credentials.link_checker_api_secret_token
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def webhook_uri
end

def webhook_secret_token
Rails.application.secrets.link_checker_api_secret_token
Rails.application.credentials.link_checker_api_secret_token
end

def link_checker_api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
stub1 = stub_link_checker_api_create_batch(
uris: [link1.url],
webhook_uri: "http://local-links-manager.dev.gov.uk/link-check-callback",
webhook_secret_token: Rails.application.secrets.link_checker_api_secret_token,
webhook_secret_token: Rails.application.credentials.link_checker_api_secret_token,
)

stub2 = stub_link_checker_api_create_batch(
uris: [link2.url],
webhook_uri: "http://local-links-manager.dev.gov.uk/link-check-callback",
webhook_secret_token: Rails.application.secrets.link_checker_api_secret_token,
webhook_secret_token: Rails.application.credentials.link_checker_api_secret_token,
)

stub3 = stub_link_checker_api_create_batch(
uris: [local_authority1.homepage_url, local_authority2.homepage_url],
webhook_uri: "http://local-links-manager.dev.gov.uk/link-check-callback",
webhook_secret_token: Rails.application.secrets.link_checker_api_secret_token,
webhook_secret_token: Rails.application.credentials.link_checker_api_secret_token,
)

link_status_requester.call
Expand All @@ -47,13 +47,13 @@
homepage_stub = stub_link_checker_api_create_batch(
uris: [disabled_service_link.local_authority.homepage_url],
webhook_uri: "http://local-links-manager.dev.gov.uk/link-check-callback",
webhook_secret_token: Rails.application.secrets.link_checker_api_secret_token,
webhook_secret_token: Rails.application.credentials.link_checker_api_secret_token,
)

homepage_and_link_stub = stub_link_checker_api_create_batch(
uris: [disabled_service_link.url, disabled_service_link.local_authority.homepage_url],
webhook_uri: "http://local-links-manager.dev.gov.uk/link-check-callback",
webhook_secret_token: Rails.application.secrets.link_checker_api_secret_token,
webhook_secret_token: Rails.application.credentials.link_checker_api_secret_token,
)

link_status_requester.call
Expand All @@ -72,7 +72,7 @@
stub1 = stub_link_checker_api_create_batch(
uris: [link1.url, local_authority1.homepage_url],
webhook_uri: "http://local-links-manager.dev.gov.uk/link-check-callback",
webhook_secret_token: Rails.application.secrets.link_checker_api_secret_token,
webhook_secret_token: Rails.application.credentials.link_checker_api_secret_token,
)

link_status_requester.check_authority_urls "ambridge"
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/link_checker_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
subject(:status_updater) { described_class.new }

def webhook_secret_token
Rails.application.secrets.link_checker_api_secret_token
Rails.application.credentials.link_checker_api_secret_token
end

def generate_signature(body)
Expand Down

0 comments on commit a064968

Please sign in to comment.