Skip to content

Commit

Permalink
Fix endpoint getting fixed at compile-time
Browse files Browse the repository at this point in the history
Endpoint was getting baked in at compile-time, so changing env at
runtime had no effect.

Fixes #44
  • Loading branch information
dvcrn committed Oct 29, 2023
1 parent 2a5efed commit 3688e72
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/binance/rest/http_client.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
defmodule Binance.Rest.HTTPClient do
@endpoint Application.get_env(:binance, :end_point, "https://api.binance.com")
defp endpoint() do
Application.get_env(:binance, :end_point, "https://api.binance.com")
end

defp prepare_request(url, params, secret_key, api_key) do

Check warning on line 6 in lib/binance/rest/http_client.ex

View workflow job for this annotation

GitHub Actions / test (24.3, 1.14.5)

function prepare_request/4 is unused

Check warning on line 6 in lib/binance/rest/http_client.ex

View workflow job for this annotation

GitHub Actions / test (25.3, 1.14.5)

function prepare_request/4 is unused

Check warning on line 6 in lib/binance/rest/http_client.ex

View workflow job for this annotation

GitHub Actions / test (26.1, 1.14.5)

function prepare_request/4 is unused

Check warning on line 6 in lib/binance/rest/http_client.ex

View workflow job for this annotation

GitHub Actions / test (24.3, 1.14.5)

function prepare_request/4 is unused

Check warning on line 6 in lib/binance/rest/http_client.ex

View workflow job for this annotation

GitHub Actions / testolder (23.3, 1.14)

function prepare_request/4 is unused

Check warning on line 6 in lib/binance/rest/http_client.ex

View workflow job for this annotation

GitHub Actions / testolder (23.3, 1.14)

function prepare_request/4 is unused

Check warning on line 6 in lib/binance/rest/http_client.ex

View workflow job for this annotation

GitHub Actions / test (26.1, 1.14.5)

function prepare_request/4 is unused

Check warning on line 6 in lib/binance/rest/http_client.ex

View workflow job for this annotation

GitHub Actions / test (25.3, 1.14.5)

function prepare_request/4 is unused
case validate_credentials(secret_key, api_key) do
Expand Down Expand Up @@ -32,7 +34,7 @@ defmodule Binance.Rest.HTTPClient do
end

defp request_binance(url, body, method) do
url = URI.parse("#{@endpoint}#{url}")
url = URI.parse("#{endpoint()}#{url}")

encoded_url =
if body != "" do
Expand Down

0 comments on commit 3688e72

Please sign in to comment.