forked from YokaiRick/akkoma
make httppoison use configurable http proxy
This commit is contained in:
parent
5c09d8d3f1
commit
5ddd15d794
2 changed files with 18 additions and 1 deletions
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
config :pleroma, :websub, Pleroma.Web.Websub
|
config :pleroma, :websub, Pleroma.Web.Websub
|
||||||
config :pleroma, :ostatus, Pleroma.Web.OStatus
|
config :pleroma, :ostatus, Pleroma.Web.OStatus
|
||||||
config :pleroma, :httpoison, HTTPoison
|
config :pleroma, :httpoison, Pleroma.HTTP
|
||||||
|
|
||||||
version = with {version, 0} <- System.cmd("git", ["rev-parse", "HEAD"]) do
|
version = with {version, 0} <- System.cmd("git", ["rev-parse", "HEAD"]) do
|
||||||
"Pleroma #{String.trim(version)}"
|
"Pleroma #{String.trim(version)}"
|
||||||
|
@ -40,6 +40,9 @@
|
||||||
_ -> "Pleroma dev"
|
_ -> "Pleroma dev"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config :pleroma, :http,
|
||||||
|
proxy_url: ""
|
||||||
|
|
||||||
config :pleroma, :instance,
|
config :pleroma, :instance,
|
||||||
version: version,
|
version: version,
|
||||||
name: "Pleroma",
|
name: "Pleroma",
|
||||||
|
|
14
lib/pleroma/http/http.ex
Normal file
14
lib/pleroma/http/http.ex
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
defmodule Pleroma.HTTP do
|
||||||
|
use HTTPoison.Base
|
||||||
|
|
||||||
|
def process_request_options(options) do
|
||||||
|
config = Application.get_env(:pleroma, :http, [])
|
||||||
|
proxy = Keyword.get(config, :proxy_url, "")
|
||||||
|
case proxy do
|
||||||
|
"" -> options
|
||||||
|
_ -> options ++ [proxy: proxy]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in a new issue