diff --git a/.gitignore b/.gitignore index d5be28f..8da88b2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /db /deps /*.ez +.envrc # Generated on crash by the VM erl_crash.dump @@ -24,4 +25,4 @@ npm-debug.log # Alternatively, you may comment the line below and commit the # secrets files as long as you replace their contents by environment # variables. -/config/*.secret.exs \ No newline at end of file +/config/*.secret.exs diff --git a/config/config.exs b/config/config.exs index 1f40fbc..edd0ab8 100644 --- a/config/config.exs +++ b/config/config.exs @@ -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" diff --git a/lib/faces/gallery/github_user_data.ex b/lib/faces/gallery/github_user_data.ex index 3d09fdf..55f6310 100644 --- a/lib/faces/gallery/github_user_data.ex +++ b/lib/faces/gallery/github_user_data.ex @@ -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