Use an access token because it avoids the rate limit.
This commit is contained in:
parent
873cdfe6a4
commit
41db949fcd
3 changed files with 13 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,6 +3,7 @@
|
|||
/db
|
||||
/deps
|
||||
/*.ez
|
||||
.envrc
|
||||
|
||||
# Generated on crash by the VM
|
||||
erl_crash.dump
|
||||
|
|
|
@ -22,6 +22,8 @@ config :logger, :console,
|
|||
|
||||
config :faces, Faces.Repo, migration_timestamps: [type: :utc_datetime]
|
||||
|
||||
config :faces, Faces.Gallery.GithubUserData, access_token: System.get_env("GITHUB_ACCESS_TOKEN")
|
||||
|
||||
# Import environment specific config. This must remain at the bottom
|
||||
# of this file so it overrides the configuration defined above.
|
||||
import_config "#{Mix.env()}.exs"
|
||||
|
|
|
@ -36,7 +36,15 @@ defmodule Faces.Gallery.GithubUserData do
|
|||
|
||||
defp get_user_from_github(username) do
|
||||
username
|
||||
|> Users.find(Client.new())
|
||||
|> Users.find(github_client())
|
||||
end
|
||||
|
||||
defp github_client, do: Client.new(%{access_token: github_access_token()})
|
||||
|
||||
defp github_access_token do
|
||||
:faces
|
||||
|> Application.get_env(__MODULE__, [])
|
||||
|> Keyword.get(:access_token)
|
||||
end
|
||||
|
||||
defp just_the_facts(user_data) do
|
||||
|
|
Reference in a new issue