diff --git a/docs/development/setting_up_akkoma_dev.md b/docs/development/setting_up_akkoma_dev.md index 33ec24f6c..a0b5e441b 100644 --- a/docs/development/setting_up_akkoma_dev.md +++ b/docs/development/setting_up_akkoma_dev.md @@ -36,6 +36,33 @@ config :logger, :console, level: :info ``` +## Testing with HTTPS + +If you end up developing alongside other software like misskey, +you will not be able to federate without an SSL certificate. You should +be able to use the snakeoil certificate that comes standard with most +distributions or generate one from scratch, then force elixir to accept it. + +HTTP clients are none too keep to accept self-signed certs, but we can do +this: + +```elixir +config :pleroma, :http, + adapter: [ + pools: %{ + default: [ + conn_opts: [ + transport_opts: [ + verify: :verify_none + ] + ] + ] + } + ] +``` + +Now your SSL requests will work. Hooray. + ## Testing 1. Create a `test.secret.exs` file with the content as shown below diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 0f4f5a358..33ba86406 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -58,9 +58,6 @@ defmodule Pleroma.Application do Pleroma.Docs.JSON.compile() limiters_setup() - Logger.info("Starting Finch") - Finch.start_link(name: MyFinch) - # Define workers and child supervisors to be supervised children = [ @@ -70,6 +67,7 @@ defmodule Pleroma.Application do Pleroma.Web.Plugs.RateLimiter.Supervisor ] ++ cachex_children() ++ + http_children() ++ [ Pleroma.Stats, Pleroma.JobQueueMonitor, @@ -276,4 +274,13 @@ defmodule Pleroma.Application do ConcurrentLimiter.new(module, max_running, max_waiting) end) end + + defp http_children do + config = + [:http, :adapter] + |> Config.get([]) + |> Keyword.put(:name, MyFinch) + + [{Finch, config}] + end end diff --git a/lib/pleroma/http.ex b/lib/pleroma/http.ex index 01f307d17..d8028651c 100644 --- a/lib/pleroma/http.ex +++ b/lib/pleroma/http.ex @@ -65,7 +65,6 @@ defmodule Pleroma.HTTP do options = put_in(options[:adapter], adapter_opts) params = options[:params] || [] request = build_request(method, headers, options, url, body, params) - client = Tesla.client([Tesla.Middleware.FollowRedirects]) request(client, request)