Created
July 5, 2018 19:50
-
-
Save veverkap/df581801eb36f9b3c0a48f69a7f93d5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule SetGithubEvents do | |
import Plug.Conn | |
def init(opts), do: opts | |
def call(conn, _) do | |
event = List.keyfind(conn.req_headers, signature_header(), 0) | |
conn | |
|> handle_event(event) | |
end | |
defp handle_event(%{params: params} = conn, {_, "status"}) do | |
conn | |
end | |
defp handle_event(conn, _) do | |
conn | |
end | |
defp signature_header, do: Application.get_env(:forge, :github_event_header, "x-github-event") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment