joken-elixir / joken_jwks

A Joken 2 hook for fetching the signer from a public JWKS url
Apache License 2.0
29 stars 24 forks source link

Optional dependency on `:hackney` #32

Closed gseddon closed 1 year ago

gseddon commented 2 years ago

Hi,

I was pleased to see that the Tesla adapter in the HTTP Fetcher is user configurable

 defp new(opts) do
    adapter =
      Application.get_env(:tesla, __MODULE__)[:adapter] ||
        Application.get_env(:tesla, :adapter, @default_adapter)

However, in the root mix.exs, the :hackney dependency is a hard requirement, meaning that it has to be pulled in, along with its many sub-dependencies, regardless of choice of adapter. Can it be changed to be an optional requirement in the dependencies instead please? It's a 1 line change :)

...
defp deps do
    [
      {:joken, "~> 2.4"},
      {:jason, "~> 1.2"},
      {:tesla, "~> 1.4"},
      {:hackney, "~> 1.17.4 or ~> 1.18.0", optional: true},
      {:telemetry, "~> 0.4.2 or ~> 1.0"},
...
victorolinasc commented 2 years ago

Makes total sense! PR welcomed :)