Skip to content

Commit

Permalink
Update OFAC script to use new token
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmartt committed Apr 22, 2024
1 parent bbec2b7 commit 104a12f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/services/parse_ofac_list_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def self.fetch_github_file_content(repo_owner:, repo_name:, branch:, file_path:,
https.use_ssl = true

request = Net::HTTP::Get.new(uri)
request.add_field("Authorization", github_headers["Authorization"])
request.add_field("User-Agent", github_headers["User-Agent"])
request.add_field("Authorization", github_headers[:Authorization])
request.add_field("Accept", github_headers[:Accept])

response = https.request(request)
content_data = JSON.parse(response.body)
Expand All @@ -30,10 +30,10 @@ def self.fetch_github_file_content(repo_owner:, repo_name:, branch:, file_path:,
end

def self.fetch_github_repo_top_level_files(repo_owner:, repo_name:, branch:)
github_token = Rails.configuration.pub_secrets[:api_auth_token_github]
github_token = Rails.configuration.pub_secrets[:github_ofac_token]
github_headers = {
Accept: "application/vnd.github.v3+json",
Authorization: "token #{github_token}"
"Accept": "application/vnd.github.v3+json",
"Authorization": "token #{github_token}"
}

uri = URI("https://api.github.com/repos/#{repo_owner}/#{repo_name}/git/trees/#{branch}?recursive=1")
Expand Down
1 change: 1 addition & 0 deletions config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ default: &default
slack_webhook_url: <%= ENV["SLACK_WEBHOOK_URL"] %>
# For access to Github API
api_auth_token_github: <%= ENV["API_AUTH_TOKEN_GITHUB"] %>
github_ofac_token: <%= ENV["API_AUTH_TOKEN_GITHUB_OFAC"] %>
# e.g. publishers.brave.com
url_host: <%= ENV["URL_HOST"] %>
uphold_authorization_endpoint: <%= ENV["UPHOLD_AUTHORIZATION_ENDPOINT"] %>
Expand Down

0 comments on commit 104a12f

Please sign in to comment.