Skip to content

Commit

Permalink
Merge pull request #3 from siafulabs/master
Browse files Browse the repository at this point in the history
changed api key to also pull from opts
  • Loading branch information
gabrielpra1 authored Feb 16, 2021
2 parents da87c81 + 20d7982 commit 48447fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/client/tesla.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ defmodule ExSignal.Client.Tesla do
@impl true
def build_client(opts \\ []) do
timeout = Keyword.get(opts, :timeout, 30_000)
api_key = Keyword.get(opts, :api_key, ExSignal.config(:api_key))

middleware = [
{Tesla.Middleware.BaseUrl, ExSignal.config(:api_url, "https://onesignal.com/api/v1")},
Tesla.Middleware.JSON,
{Tesla.Middleware.Headers, [{"Authorization", "Basic #{ExSignal.config(:api_key)}"}]},
{Tesla.Middleware.Headers, [{"Authorization", "Basic #{api_key}"}]},
]
adapter = {Tesla.Adapter.Hackney, [recv_timeout: timeout]}

Expand Down

0 comments on commit 48447fc

Please sign in to comment.