2020-10-12 11:00:50 -06:00
|
|
|
# Pleroma: A lightweight social networking server
|
2021-01-12 23:49:20 -07:00
|
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
2020-10-12 11:00:50 -06:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-05-05 16:51:10 -06:00
|
|
|
defmodule Pleroma.HTTP.AdapterHelper.Default do
|
|
|
|
alias Pleroma.HTTP.AdapterHelper
|
|
|
|
|
|
|
|
@behaviour Pleroma.HTTP.AdapterHelper
|
|
|
|
|
|
|
|
@spec options(keyword(), URI.t()) :: keyword()
|
|
|
|
def options(opts, _uri) do
|
2022-08-14 17:13:49 -06:00
|
|
|
proxy = Pleroma.Config.get([:http, :proxy_url])
|
2022-11-24 05:27:16 -07:00
|
|
|
pool_timeout = Pleroma.Config.get([:http, :pool_timeout], 5000)
|
|
|
|
receive_timeout = Pleroma.Config.get([:http, :receive_timeout], 15_000)
|
|
|
|
|
|
|
|
opts
|
|
|
|
|> AdapterHelper.maybe_add_proxy(AdapterHelper.format_proxy(proxy))
|
|
|
|
|> Keyword.put(:pool_timeout, pool_timeout)
|
|
|
|
|> Keyword.put(:receive_timeout, receive_timeout)
|
2020-05-05 16:51:10 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
@spec get_conn(URI.t(), keyword()) :: {:ok, keyword()}
|
|
|
|
def get_conn(_uri, opts), do: {:ok, opts}
|
|
|
|
end
|