aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/pleroma/gun/api/api.ex2
-rw-r--r--lib/pleroma/gun/api/gun.ex22
-rw-r--r--lib/pleroma/gun/connections.ex17
-rw-r--r--mix.exs2
-rw-r--r--mix.lock2
5 files changed, 26 insertions, 19 deletions
diff --git a/lib/pleroma/gun/api/api.ex b/lib/pleroma/gun/api/api.ex
index c69ab890e..19adc1bf0 100644
--- a/lib/pleroma/gun/api/api.ex
+++ b/lib/pleroma/gun/api/api.ex
@@ -10,6 +10,6 @@ defmodule Pleroma.Gun.API do
end
defp api do
- Pleroma.Config.get([Pleroma.Gun.API], :gun)
+ Pleroma.Config.get([Pleroma.Gun.API], Pleroma.Gun.API.Gun)
end
end
diff --git a/lib/pleroma/gun/api/gun.ex b/lib/pleroma/gun/api/gun.ex
new file mode 100644
index 000000000..14a4b7275
--- /dev/null
+++ b/lib/pleroma/gun/api/gun.ex
@@ -0,0 +1,22 @@
+defmodule Pleroma.Gun.API.Gun do
+ @behaviour Pleroma.Gun.API
+
+ @gun_keys [
+ :connect_timeout,
+ :http_opts,
+ :http2_opts,
+ :protocols,
+ :retry,
+ :retry_timeout,
+ :trace,
+ :transport,
+ :tls_opts,
+ :tcp_opts,
+ :ws_opts
+ ]
+
+ @impl Pleroma.Gun.API
+ def open(host, port, opts) do
+ :gun.open(host, port, Map.take(opts, @gun_keys))
+ end
+end
diff --git a/lib/pleroma/gun/connections.ex b/lib/pleroma/gun/connections.ex
index b8cf2f9b5..a3f1b0351 100644
--- a/lib/pleroma/gun/connections.ex
+++ b/lib/pleroma/gun/connections.ex
@@ -11,20 +11,6 @@ defmodule Pleroma.Gun.Connections do
conns: %{domain() => conn()}
}
- @gun_keys [
- :connect_timeout,
- :http_opts,
- :http2_opts,
- :protocols,
- :retry,
- :retry_timeout,
- :trace,
- :transport,
- :tls_opts,
- :tcp_opts,
- :ws_opts
- ]
-
defstruct conns: %{}
def start_link(name \\ __MODULE__) do
@@ -95,8 +81,7 @@ defmodule Pleroma.Gun.Connections do
{:noreply, state}
nil ->
- {:ok, conn} =
- Pleroma.Gun.API.open(to_charlist(uri.host), uri.port, Map.take(opts, @gun_keys))
+ {:ok, conn} = Pleroma.Gun.API.open(to_charlist(uri.host), uri.port, opts)
state =
put_in(state.conns[key], %Pleroma.Gun.Conn{
diff --git a/mix.exs b/mix.exs
index 29f1c90c5..64c56c4e3 100644
--- a/mix.exs
+++ b/mix.exs
@@ -114,7 +114,7 @@ defmodule Pleroma.Mixfile do
{
:tesla,
github: "alex-strizhakov/tesla",
- ref: "929d68446a9b9d08149bd92d5b51c7ae9f87cfee",
+ ref: "28b06f772632fe82d9fb4cc39b0477709b1f3d6f",
override: true
},
{:cowlib, "~> 2.7.3", override: true},
diff --git a/mix.lock b/mix.lock
index 1d4532fed..554b81fa8 100644
--- a/mix.lock
+++ b/mix.lock
@@ -85,7 +85,7 @@
"swoosh": {:hex, :swoosh, "0.23.2", "7dda95ff0bf54a2298328d6899c74dae1223777b43563ccebebb4b5d2b61df38", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm"},
"syslog": {:git, "https://github.com/Vagabond/erlang-syslog.git", "4a6c6f2c996483e86c1320e9553f91d337bcb6aa", [tag: "1.0.5"]},
"telemetry": {:hex, :telemetry, "0.4.0", "8339bee3fa8b91cb84d14c2935f8ecf399ccd87301ad6da6b71c09553834b2ab", [:rebar3], [], "hexpm"},
- "tesla": {:git, "https://github.com/alex-strizhakov/tesla.git", "929d68446a9b9d08149bd92d5b51c7ae9f87cfee", [ref: "929d68446a9b9d08149bd92d5b51c7ae9f87cfee"]},
+ "tesla": {:git, "https://github.com/alex-strizhakov/tesla.git", "28b06f772632fe82d9fb4cc39b0477709b1f3d6f", [ref: "28b06f772632fe82d9fb4cc39b0477709b1f3d6f"]},
"timex": {:hex, :timex, "3.6.1", "efdf56d0e67a6b956cc57774353b0329c8ab7726766a11547e529357ffdc1d56", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5 or ~> 1.0.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm"},
"trailing_format_plug": {:hex, :trailing_format_plug, "0.0.7", "64b877f912cf7273bed03379936df39894149e35137ac9509117e59866e10e45", [:mix], [{:plug, "> 0.12.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"tzdata": {:hex, :tzdata, "0.5.21", "8cbf3607fcce69636c672d5be2bbb08687fe26639a62bdcc283d267277db7cf0", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm"},