Skip to content

Commit f28ba34

Browse files
authored
Merge pull request #1112 from code-corps/fetch-github-env-variables-at-runtime
Rewrote CodeCorps.GitHub so that access token request params are fetced at runtime
2 parents d6591ee + 185db06 commit f28ba34

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/code_corps/github/github.ex

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
defmodule CodeCorps.GitHub do
22
alias CodeCorps.GitHub.API.Headers
33

4-
@client_id Application.get_env(:code_corps, :github_app_client_id)
5-
@client_secret Application.get_env(:code_corps, :github_app_client_secret)
6-
7-
@base_access_token_params %{
8-
client_id: @client_id,
9-
client_secret: @client_secret
10-
}
11-
124
defmodule APIErrorObject do
135
@moduledoc """
146
Represents an error object from the GitHub API.
@@ -168,8 +160,11 @@ defmodule CodeCorps.GitHub do
168160

169161
@spec build_access_token_params(String.t, String.t) :: map
170162
defp build_access_token_params(code, state) do
171-
@base_access_token_params
172-
|> Map.put(:code, code)
173-
|> Map.put(:state, state)
163+
%{
164+
client_id: Application.get_env(:code_corps, :github_app_client_id),
165+
client_secret: Application.get_env(:code_corps, :github_app_client_secret),
166+
code: code,
167+
state: state
168+
}
174169
end
175170
end

0 commit comments

Comments
 (0)