Merge pull request 'metrics' (#375) from stats into develop
[akkoma] / lib / pleroma / http / adapter_helper / default.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.HTTP.AdapterHelper.Default do
6 alias Pleroma.HTTP.AdapterHelper
7
8 @behaviour Pleroma.HTTP.AdapterHelper
9
10 @spec options(keyword(), URI.t()) :: keyword()
11 def options(opts, _uri) do
12 proxy = Pleroma.Config.get([:http, :proxy_url])
13 pool_timeout = Pleroma.Config.get([:http, :pool_timeout], 5000)
14 receive_timeout = Pleroma.Config.get([:http, :receive_timeout], 15_000)
15
16 opts
17 |> AdapterHelper.maybe_add_proxy(AdapterHelper.format_proxy(proxy))
18 |> Keyword.put(:pool_timeout, pool_timeout)
19 |> Keyword.put(:receive_timeout, receive_timeout)
20 end
21
22 @spec get_conn(URI.t(), keyword()) :: {:ok, keyword()}
23 def get_conn(_uri, opts), do: {:ok, opts}
24 end