mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-27 03:04:12 +00:00
29 lines
832 B
Elixir
29 lines
832 B
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
defmodule Pleroma.ReverseProxy.Client.Wrapper do
|
|
@moduledoc "Meta-client that calls the appropriate client from the config."
|
|
@behaviour Pleroma.ReverseProxy.Client
|
|
|
|
@impl true
|
|
def request(method, url, headers, body \\ "", opts \\ []) do
|
|
client().request(method, url, headers, body, opts)
|
|
end
|
|
|
|
@impl true
|
|
def stream_body(ref), do: client().stream_body(ref)
|
|
|
|
@impl true
|
|
def close(ref), do: client().close(ref)
|
|
|
|
defp client do
|
|
:tesla
|
|
|> Application.get_env(:adapter)
|
|
|> client()
|
|
end
|
|
|
|
defp client({Tesla.Adapter.Finch, _}), do: Pleroma.ReverseProxy.Client.Tesla
|
|
defp client(_), do: Pleroma.Config.get!(Pleroma.ReverseProxy.Client)
|
|
end
|