From 5ddd15d794bc8f9be3ca073589bab1f92b001cce Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sat, 30 Dec 2017 11:35:53 -0500 Subject: [PATCH] make httppoison use configurable http proxy --- config/config.exs | 5 ++++- lib/pleroma/http/http.ex | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lib/pleroma/http/http.ex diff --git a/config/config.exs b/config/config.exs index 503ce8d64..28335a6d4 100644 --- a/config/config.exs +++ b/config/config.exs @@ -32,7 +32,7 @@ config :mime, :types, %{ config :pleroma, :websub, Pleroma.Web.Websub 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 "Pleroma #{String.trim(version)}" @@ -40,6 +40,9 @@ version = with {version, 0} <- System.cmd("git", ["rev-parse", "HEAD"]) do _ -> "Pleroma dev" end +config :pleroma, :http, + proxy_url: "" + config :pleroma, :instance, version: version, name: "Pleroma", diff --git a/lib/pleroma/http/http.ex b/lib/pleroma/http/http.ex new file mode 100644 index 000000000..31135411c --- /dev/null +++ b/lib/pleroma/http/http.ex @@ -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 -- 2.45.2