Use an access token because it avoids the rate limit.
This commit is contained in:
parent
81e58fa152
commit
304900a418
3 changed files with 13 additions and 2 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,6 +3,7 @@
|
||||||
/db
|
/db
|
||||||
/deps
|
/deps
|
||||||
/*.ez
|
/*.ez
|
||||||
|
.envrc
|
||||||
|
|
||||||
# Generated on crash by the VM
|
# Generated on crash by the VM
|
||||||
erl_crash.dump
|
erl_crash.dump
|
||||||
|
@ -24,4 +25,4 @@ npm-debug.log
|
||||||
# Alternatively, you may comment the line below and commit the
|
# Alternatively, you may comment the line below and commit the
|
||||||
# secrets files as long as you replace their contents by environment
|
# secrets files as long as you replace their contents by environment
|
||||||
# variables.
|
# variables.
|
||||||
/config/*.secret.exs
|
/config/*.secret.exs
|
||||||
|
|
|
@ -22,6 +22,8 @@ config :logger, :console,
|
||||||
|
|
||||||
config :faces, Faces.Repo, migration_timestamps: [type: :utc_datetime]
|
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
|
# Import environment specific config. This must remain at the bottom
|
||||||
# of this file so it overrides the configuration defined above.
|
# of this file so it overrides the configuration defined above.
|
||||||
import_config "#{Mix.env()}.exs"
|
import_config "#{Mix.env()}.exs"
|
||||||
|
|
|
@ -36,7 +36,15 @@ defmodule Faces.Gallery.GithubUserData do
|
||||||
|
|
||||||
defp get_user_from_github(username) do
|
defp get_user_from_github(username) do
|
||||||
username
|
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
|
end
|
||||||
|
|
||||||
defp just_the_facts(user_data) do
|
defp just_the_facts(user_data) do
|
||||||
|
|
Reference in a new issue