Skip to content

Commit b46a791

Browse files
committed
Add github auth
1 parent e5f97aa commit b46a791

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: config/runtime.exs

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ if config_env() == :prod do
1515
session_signing_salt: System.fetch_env!("HEXDOCS_SESSION_SIGNING_SALT"),
1616
session_encryption_salt: System.fetch_env!("HEXDOCS_SESSION_ENCRYPTION_SALT"),
1717
queue_concurrency: String.to_integer(System.fetch_env!("HEXDOCS_QUEUE_CONCURRENCY")),
18+
github_user: System.fetch_env!("HEXDOCS_GITHUB_USER"),
19+
github_token: System.fetch_env!("HEXDOCS_GITHUB_TOKEN"),
1820
host: System.fetch_env!("HEXDOCS_HOST")
1921

2022
config :hexdocs, :repo_bucket, name: System.fetch_env!("HEXDOCS_REPO_BUCKET")

Diff for: lib/hexdocs/source_repo/github.ex

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ defmodule Hexdocs.SourceRepo.GitHub do
44

55
@impl true
66
def versions(repo) do
7+
user = Application.get_env(:hexdocs, :github_user)
8+
token = Application.get_env(:hexdocs, :github_token)
79
url = @github_url <> "/repos/#{repo}/tags"
810

911
headers = [
1012
accept: "application/json"
1113
]
1214

1315
options = [
14-
:with_body
16+
:with_body,
17+
basic_auth: {user, token}
1518
]
1619

1720
Hexdocs.HTTP.retry("github", url, fn ->

0 commit comments

Comments
 (0)