From 20d7982d00e0c141c200858cf54db5f91e1a86e0 Mon Sep 17 00:00:00 2001 From: Peter de Croos Date: Mon, 15 Feb 2021 11:31:42 -0500 Subject: [PATCH] changed api key to also pull from opts --- lib/client/tesla.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/client/tesla.ex b/lib/client/tesla.ex index 507448c..d4c4ec4 100644 --- a/lib/client/tesla.ex +++ b/lib/client/tesla.ex @@ -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]}